开发者

JQL ORDER BY clause and inheritance

开发者 https://www.devze.com 2023-01-26 23:12 出处:网络
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 na

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消