Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic