• Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate mapping sort / order-by?

 
Vijay Kashyap
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What should I use (sort or order-by) if I need to fetch a Set(one-to-many mapping)? How is sort different from order-by?

Thanks,
Vijay
 
pascal betz
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
from hibernate doc:

sort="unsorted|natural|comparatorClass"
order-by="column_name asc|desc"


order by is SQL order by, performed in DB
sort is in memory sorting based on natural order or trough a comparator class.

pascal
 
Vijay Kashyap
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops...

Why didn't it strike my mind before

Thxs Pascal
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!