cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Gentry <>
Subject Re: Type safe queries & more
Date Fri, 16 Sep 2011 13:22:20 GMT
Hi Atli,

Using ExpressionFactory, you can avoid a lot of the text-based queries
by using the constants generated by Cayenne Modeler in the superclass.
 Something like:

Expression exp = ExpressionFactory.matchExp(User.USERNAME_PROPERTY, username);

In 3.1, a static makePath() method has been added to CayenneDataObject
to make it easier to use the constants with relationships:

Expression exp =

makePath() joins the strings you pass it with a "." so you end up with
something like "", but it is using Java constants so you
can't introduce typos.

I'm not trying to distract from the current (and interesting)
conversation, just pointing out ExpressionFactory if you missed it.



2011/9/16 Atli Páll Hafsteinsson <>:
> For me a big part of the reason for implementing this is to get rid of
> text based queries as they cannot be verified and therefore error
> prone. Plus you have to know more about the data structure.

View raw message