On Apr 7, 2006, at 11:19 PM, Andrus Adamchik wrote:
2. I had a line of code in a copy of the DataPort example:
select.setRoot(entity). The javadocs say that setRoot() is
deprecated
and to access root via getMetaData(). I don't see how to setRoot
() that
way. (I saw BaseQueryMetadata.resolve() but that seems rather
round-about and it's not a public method anyway.)
The entire concept of "query root" is deprecated (i.e. Cayenne
access stack no longer cares whether a query has a root or not), so
'setRoot' is deprecated in the Query interface. However queries
that inherit from AbstractQuery still have undeprecated "setRoot"
method. Those are the queries where root still makes sense.
A few more notes about the queries. Cayenne <= 1.1.x could execute a
handful of built-in queries. Each query was a metadata object with no
behavior. In 1.2 Query interface was split into lifecycle part
(Query) and metadata part (QueryMetadata). This made possible two new
features -
1. Treating selecting and updating queries the same way at the
DataContext level.
2. Custom and indirect queries: http://objectstyle.org/confluence/
display/CAYDOC/Queries
Again, the reason why there is no setters in Query or QueryMetadata
interfaces is that Cayenne itself never modifies a query. Concrete
queries can define any setters that make sense - Cayenne doesn't need
to know about them.
Andrus