jpa - Get counts of values of an Enum in JQL -


is thare way jql can counts according values of enum? example, enum has values single, married, divorced, etc. , counts of persons entity in single java persistence language query?

there 2 ways, either use group by, or sub-selects in select clause,

select count(p), p.status person p group p.status 

or,

select (select count(p) person p p.status = status.single), (select count(p) person p p.status = status.married), (select count(p) person p p.status = status.divorced) 

but sub-selects in select clause not supported jpa (at least jpa 2.0, 2.1 believe), eclipselink 2.4 or greater support this.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -