@Retention(value=RUNTIME)
@Target(value={FIELD,METHOD})
public @interface XOrderBy
@OrderBy
. Applies to collections.
The @OrderBy
of JPA does not allow to use qualified properties
(properties of references).
OpenXava has its own version of @OrderBy
, this @XOrderBy
to allow it.
Example:
@OneToMany (mappedBy="invoice", cascade=CascadeType.REMOVE) @ListProperties("product.description, quantity, unitPrice, amount") @XOrderBy("product.description desc") private Collection<InvoiceDetail> details;You can note as
product.description
can be used for ordering the collection.@ListProperties
,
as in this case with product.description
.
The order in @XOrderBy
has only effect at visual level, when
you access programmatically to the collection, the collection is ordered as
indicated by the JPA @OrderBy
or by its default order.
Modifier and Type | Required Element and Description |
---|---|
java.lang.String |
value
The order using the syntax of JPA
@OrderBy but allowing
qualified properties with any level of indirection. |