New feature: scalar functions in expressions

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Jul 18 2006 - 18:07:10 EDT

  • Next message: Jean T. Anderson: "Re: NOTICE Text"

    Getting in 3.0 mode for a while. I would like to support SQL (or
    arbitrary user-defined) functions in Cayenne Expressions. Here is
    some ideas:

    http://objectstyle.org/confluence/display/CAY/Expression+Functions

    As I mentioned on Wiki, what prompted me to look closer into this is
    realization that there is no way other than DerivedDbEntity (and
    SQLTemplate of course) to define a derived column and do ORDER BY on
    it. The expression in question was "case when X>0 then (Y/X) else 0
    end". Seems like support for functions in qualifiers and orderings
    (of which Expression is a common abstraction) should be a nice fix to
    that.

    BTW, I thought of a WebObjects-like solution (http://tinyurl.com/
    nbats) of defining the SQL script right in the column
    (DerivedDbEntity works sort of like this). At the end I figured it is
    not good at all, as it ends up being a read-only attribute, that gets
    out of sync with the attributes it is derived from if the object is
    updated... All very confusing and hard to use.

    Andrus



    This archive was generated by hypermail 2.0.0 : Tue Jul 18 2006 - 18:07:44 EDT