RE: Self-Join query (and field = field question)

From: McDaniel, Joe R. (mcdanij..igr.org)
Date: Wed May 25 2005 - 10:55:33 EDT

  • Next message: Julien Vignali: "Re: JNDI problem..."

    I tried figuring out whether this could be done with method calls but
    there appears to be no way to add a "from" and then I had trouble
    figuring out how to specify the contents of another field as the source
    for a .matchExp. I found the way this is done in the Cayenne code and it
    works in this example but I suspect there must be another .match or some
    "proper" way of doing this other than using ASTObjPath?

            SelectQuery qq = new SelectQuery(ZPlates.class);
            List join = new Vector();
     
    join.add(ExpressionFactory.matchExp(ZPlates.PLATE_BAR_CODE_PROPERTY, new
    ASTObjPath(ZPlates.PARENT_PLATE_PROPERTY)));
            qq.setQualifier( ExpressionFactory.joinExp(Expression.AND, join)
    );
            List platesJoin = ctxt.performQuery(qq);

    Another approach to the original problem would be to create a view, then
    the Cayenne mapping is simple.

    Best,

    Joe



    This archive was generated by hypermail 2.0.0 : Wed May 25 2005 - 10:55:35 EDT