Re: Ordering expression

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Jul 22 2010 - 18:30:16 UTC

  • Next message: Cosmin Marian: "Re: Commit performance degradation"

    EJBQLQuery will support that. I really hope we reconcile it with
    SelectQuery, as now it has to be created from String.

    Andrus

    On Jul 22, 2010, at 9:19 PM, Mike Kienenberger wrote:

    > Sorry, I misread your question. You really want to do an ordering by
    > expression rather than by column.
    >
    > There is a thread on this.
    >
    > http://mail-archives.apache.org/mod_mbox/cayenne-user/201003.mbox/%3Cdc5d39031003152211pad3d1advc5bb5c34562fbc6..ail.gmail.com%3E
    >
    > The short answer is that it's not supported. There are a number of
    > workarounds, depending on the specific query and how you need to use
    > it.
    >
    > In your specific case, perhaps you could create a view containing A+B
    > as an additional column and sort on that column.
    >
    > Or you can use an SQLTemplate to create the query.
    >
    > I believe there were other workarounds in the thread above.
    >
    >
    > On Thu, Jul 22, 2010 at 2:13 PM, Mike Kienenberger
    > <mkienen..mail.com> wrote:
    >> http://cayenne.apache.org/doc30/using-orderings.html
    >>
    >> On Thu, Jul 22, 2010 at 1:45 PM, Martin Ludeiro
    >> <martin.ludeir..mail.com> wrote:
    >>> I want to do an ordering expression with two columns, but i cant
    >>> find
    >>> the way
    >>>
    >>> The generated SQL must be something like "SELECT A, B FROM T ORDER
    >>> BY A
    >>> + B";
    >>>
    >>> Sorry for my bad english
    >>> Thanks in advance
    >>>
    >>
    >



    This archive was generated by hypermail 2.0.0 : Thu Jul 22 2010 - 18:30:48 UTC