Results 1 to 2 of 2

Thread: Ordering List Views

  1. #1
    Join Date
    Nov 2010
    Posts
    3

    Default Ordering List Views

    I'm trying to do something which I thought would take less than a second to do but unfortunately it has not.
    I'm trying to order the list view but maybe I'm doing it wrong?

    Here is a snippet of my code in products class. By default products are displayed as they are in the table I'm guessing.
    I added a order by clause in the query to make order the default value but no dice. Am I missing something?
    (no caching issues, I've made sure of that)

    @DecimalMax(value = "2")
    private BigDecimal product_percentoff;

    @DecimalMax(value = "2")
    private BigDecimal product_saleprice;

    @NotNull
    @Size(max = 200)
    private String product_url;

    private Integer scategory_id;

    private Integer store_id;


    public static List<Product> findAllProducts() {

    return entityManager().createQuery("SELECT o FROM Product o order by o.product_percentoff desc", Product.class).getResultList();
    }
    }

  2. #2
    Join Date
    Jan 2010
    Location
    Mislata - Valencia - Spain
    Posts
    162

    Default

    There is another method with seamless name and two parameters (start and end).
    This is a method you need push-in and modify too.
    Mario Martínez Sánchez
    Project Manager & Software Architect
    --------------------------
    Disid Technologies S.L.
    http://www.disid.com
    --------------------------
    gvNIX
    http://gvnix.googlecode.com
    http://www.gvnix.org

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •