JQL ORDER BY clause and inheritance
Let's say I have an entity class A
, two entity classes B
and C
which inherits from A
, and entity class D
which inherits from C
. A
and C
are abstract entit开发者_如何学JAVAies. Entity A
has a field name
. How one could construct a JQL-query which orders entities by name within each entity class. Entities of class B
sorted by name
should go first, then should go entities of class B
(also sorted by name), and then of class D
.
Select a from A a order by Type(a), a.name
The Type() function was added in JPA 2.0. Previously you would need to map the type field to be able to query on it.
精彩评论