Unsupported ordering expression

From: Gili (cowwo..bs.darktech.org)
Date: Wed Sep 14 2005 - 16:36:48 EDT

  • Next message: Todd O'Bryan: "CayenneDataObjects across RMI"

    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 : Wed Sep 14 2005 - 16:36:48 EDT