Problems with Expression.match()

From: Øyvind Harboe (oyvind.harbo..ylin.com)
Date: Fri Jun 05 2009 - 04:43:33 EDT

  • Next message: Øyvind Harboe: "Inverting an expression"

    I'm trying to figure out if a CayenneDataObject matches an
    expression and I run into various and sundry problems.

    This is the final solution I ended up with, but it's pretty ugly.

                    List l=getDataContext().performQuery(new SelectQuery(Treatment.class,
                                    expression)));
                    return l.contains(this);

    1. I can't use expression.match() because it will fail when the
    expression contains
    an array in the path. I.e. matchExp(role.members.user, user) here "members"
    will return a list, and this causes an exception for .match(), whereas it works
    fine in a query.

    2. In the above statement I don't know how to add a andExp() to only return
    "this", so I get a bigger query result than I need + unecessary post processing.
    I've run into this problem previously as well, without finding an
    elegant solution.

    -- 
    Øyvind Harboe
    Embedded software and hardware consulting services
    http://consulting.zylin.com
    



    This archive was generated by hypermail 2.0.0 : Fri Jun 05 2009 - 04:44:30 EDT