开发者

Hibernate Discriminator sort

开发者 https://www.devze.com 2023-01-03 06:22 出处:网络
I am trying to sort the records when queried on discriminator column. I am doing a HQL/ Criteria query for retrieving all the records.

I am trying to sort the records when queried on discriminator column.

I am doing a HQL/ Criteria query for retrieving all the records.

Here is my class:

abstract class A {
...
}

@DiscriminatorValue("B")
class B extends A {
}

@DiscriminatorValue("C")
class C extend开发者_Go百科s A {
}

When I return the records, I want it sorted on the discriminator value.


You can use class as attribute, for querying, sorting and grouping by.

eg: select cat from Cat cat where cat.class = 'DomesticCat'

if DomesticCat is the discriminator value of the sub class.

information @ http://doc.javanb.com/hibernate-reference-3-2-4-ga-en/queryhql.html.

0

精彩评论

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