Annotation Type XOrderBy


  • @Retention(RUNTIME)
    @Target({FIELD,METHOD})
    public @interface XOrderBy
    The eXtended version of @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.
    In order to use a qualified property, it must be included in the @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.

    Author:
    Javier Paniza
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      java.lang.String value
      The order using the syntax of JPA @OrderBy but allowing qualified properties with any level of indirection.
    • Element Detail

      • value

        java.lang.String value
        The order using the syntax of JPA @OrderBy but allowing qualified properties with any level of indirection.