Re: Order By Expression

From: Michael Gentry (mgentr..asslight.net)
Date: Tue Mar 16 2010 - 08:39:46 EDT

  • Next message: Andrus Adamchik: "Cayenne at ApacheCon 2010 in Atlanta?"

    Hi Dave,

    Since you are seeing deprecation warnings I'm assuming you are using
    Cayenne 3? If so, you should use:

    addOrdering(Ordering ordering) or
    addOrdering(String sortPathSpec, SortOrder order)

    These are defined for your SelectQuery object. Of course, if you are
    using the first of those methods, you'll have to create your own
    Ordering object first. The second creates one for you behind the
    scenes.

    Let me know if you need additional pointers!

    mrg

    On Tue, Mar 16, 2010 at 1:11 AM, Dave Dombrosky <dombr..mail.com> wrote:
    > Is there any way to use sort expressions in a query?  Something like
    > "ORDER BY column = id"?  I get the error "Unsupported ordering
    > expression" when trying to execute a query with this in it.
    >
    > Also, it looks like I might be able to do this using in-memory
    > sorting, but the Ordering(Expression sortExpression, ...) methods are
    > deprecated.  So what's the preferred way to sort on expressions in
    > Cayenne?
    >
    > -Dave
    >



    This archive was generated by hypermail 2.0.0 : Tue Mar 16 2010 - 08:41:03 EDT