Re: Unsupported ordering expression

From: Mike Kienenberger (mkienen..mail.com)
Date: Mon Sep 19 2005 - 12:25:36 EDT

  • Next message: Filip Balas: "Help with recursive relationship"

    Gili,

    I've never looked into how the ordering works or to what extent it
    provides support. Maybe you can look into this and determine if
    there's a simple patch that might extend our current ordering
    behavior. If nothing else, it'll give you a better idea of what's
    possible and what's not possible via Cayenne orderings.

    On 9/14/05, Gili <cowwo..bs.darktech.org> wrote:
    > Hi,
    >
    > I have an image cache in the database. Now, say a user requests a
    > 800x600 image and I've got that same image in two other formats:
    > 1024x768 and 1280x960, I'd want to grab 1024x768 (which is the closest
    > to my request) and scale it down. Now, I've got a query which returns
    > all matches for the image and I want to order the result-set from the
    > closest match to the worst.
    >
    > I have the query with the ordering expression
    >
    > cachedImage.imageSpecification.width - $width +
    > cachedImage.imageSpecification.height - $height +
    > cachedImage.imageSpecification.colorDepth - $colorDepth
    >
    > where $width, $height, $colorDepth are the requested dimensions. This
    > works fine in plain SQL (when I plug in the values manually) but when I
    > try using a SelectQuery under Cayenne, it throws:
    >
    > Unsupported ordering expression:
    > ((((cachedImage.imageSpecification.width - $width) +
    > cachedImage.imageSpecification.height) - $height) +
    > cachedImage.imageSpecification.colorDepth) - $colorDepth
    > at
    > org.objectstyle.cayenne.access.trans.OrderingTranslator.doTranslation(OrderingTranslator.java:119)
    > at
    > org.objectstyle.cayenne.access.trans.SelectTranslator.createSqlString(SelectTranslator.java:169)
    >
    > Any idea how I could express this in Cayenne?
    >
    > Thank you,
    > Gili
    > --
    > http://www.desktopbeautifier.com/
    >



    This archive was generated by hypermail 2.0.0 : Mon Sep 19 2005 - 12:25:40 EDT