Re: ordering a selectQuery by ID DESC

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Aug 01 2005 - 10:51:01 EDT

  • Next message: Dhruti Ramani: "Cayenne committ Exception in M-M relation"

    You may want to try this:

    new Ordering("db:" + Referentiel.ID_REFERENTIEL_PK_COLUMN,
    Ordering.DESC)

    "db:" prefix tells Cayenne that you are specifying ordering in terms
    of database columns, not object properties.

    Andrus

    On Aug 1, 2005, at 6:45 PM, stefan.leidne..udor.lu wrote:

    >
    > hello,
    >
    > i try to execute a SelectQuery wich results i want to be in the
    > descending order according to the ID of my object
    >
    > DataContext ctx= CayenneMappingFactory.getInstance().getDataContext();
    > SelectQuery query=new SelectQuery(Referentiel.class);
    > query.setDistinct(false);
    > query.addOrdering(new Ordering
    > (Referentiel.ID_REFERENTIEL_PK_COLUMN, Ordering.DESC));
    > List list=ctx.performQuery(query);
    >
    > it works perfectly on all attributes but not on the ID_PK
    >
    > have someone an idea ?
    >
    > thanks



    This archive was generated by hypermail 2.0.0 : Mon Aug 01 2005 - 10:50:58 EDT