What is the difference between sorted and ordered collection in hibernate?Sorted Collection :
- The sorted collection is a collection that is sorted using the Java collections framework. The sorting is done in the memory of JVM that is running hibernate, soon after reading the data from the database using Java Comparator
- The less the collection the more the efficient of sorting
Ordered Collection :
- The order collections will also sorts a collection by using the order by clause for the results fetched.
- The more the collection, the more efficient of sorting.What is the difference between sorted and ordered collection in hibernate?- A sorted collection is sorted by utilizing the sorting features provided by the Java collections framework.
- The sorting occurs in the memory of JVM which running Hibernate, after the data being read from database using java comparator.
- The efficiency depends on the size of the collection.
- Ordered collection is sorted by specifying the order-by clause for sorting this collection when retrieval.
- This is an efficient way to sort larger collections.
|