Package org.hibernate.annotations
Annotation Type OrderBy
-
@Target({METHOD,FIELD}) @Retention(RUNTIME) public @interface OrderBy
Order a collection using an expression written in native SQL.The order is applied by the database when the collection is fetched, but is not maintained by operations that mutate the collection in memory. If the collection is a
Set
orMap
, the order is maintained using aLinkedHashSet
orLinkedHashMap
.- Use
OrderBy
to order using an expression written in HQL. - Use
SortComparator
to sort the collection in memory using aComparator
. - Use
SortNatural
to sort the collection in itsnatural order
. - Use
OrderColumn
to maintain the order of aList
with a dedicated index column.
It is illegal to use both
OrderBy
andOrderBy
.- See Also:
OrderBy
,SortComparator
,SortNatural
,DialectOverride.OrderBy
- Use
-
-
Element Detail
-
clause
String clause
The native SQL expression used to sort the collection elements.
-
-