191k views
5 votes
What is the difference between a sorted collection and an ordered collection in Hibernate?

A) A sorted collection uses a natural order, while an ordered collection allows custom sorting.
B) A sorted collection is indexed, while an ordered collection is not.
C) A sorted collection maintains insertion order, while an ordered collection does not.
D) A sorted collection uses SQL for sorting, while an ordered collection uses Java for sorting.

1 Answer

3 votes

Final answer:

In Hibernate, a sorted collection maintains elements in a specific order defined by a natural order or a custom sorting. An ordered collection in Hibernate maintains the insertion order of elements, regardless of their natural order or custom sorting.

Step-by-step explanation:

In Hibernate, a sorted collection is one that maintains elements in a specific order defined by a natural order or a custom sorting. For example, you can sort a collection of objects based on their names in alphabetical order. On the other hand, an ordered collection in Hibernate maintains the insertion order of elements, regardless of their natural order or custom sorting.

User Drojf
by
7.8k points