Deprecated
for removal since 6.3.
Use SQLOrder instead. This annotation will be
removed eventually, since its unqualified name collides
with jakarta..
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 java. or java.,
the order is maintained using a java. or
java.. If the collection is a bag or
java., the order is maintained by the underlying
java..
There are several other ways to order or sort a collection:
jakarta.persistence.OrderBy annotation
to order using an expression written in HQL/JPQL. Since HQL is more
portable between databases, this is the preferred alternative most
of the time.
SortComparator to sort the collection in memory using
a java.util.Comparator , or SortNatural to sort the
collection in memory according to its natural order.
jakarta.persistence.OrderColumn to maintain the order
of a java.util.List with a dedicated index column.
It's illegal to use OrderBy together with the JPA-defined
jakarta. for the same collection.
jakarta.persistence.OrderBy , SortComparator, SortNatural, DialectOverride.OrderBy
| Modifier and Type | Method and Description |
|---|---|
| public String |
| clause | back to summary |
|---|---|
| public String clause() The native SQL expression used to sort the collection elements. | |