Distinct + Order By in Hibernate
Related to my last question
I have worked with that answer, but now I require to do with a bit modification using hibernate.
I need to now add a string to TestData
class say String name
Then I want to fetch Collection of TestData
from db using hibernate with the distinct name and sorting as I did in the CollectionSort class
.
Can anyone help me how to do this using hibernate?
Thanks.
You can reuse that comparator in Hibernate, using @Sort
annotation
- Reference
精彩评论