You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Jakob Braeuchi <jb...@gmx.ch> on 2004/06/02 20:48:15 UTC

OJB : setPathClass

hi phil,

there's a difference between using setPathClass on query and on criteria level.
imo this is important for report queries where selected column can be influenced.

in the following sample i use q.setPathClass to get only Articles without extents:

Criteria crit = new Criteria();
Collection results = new Vector();
ReportQueryByCriteria q = QueryFactory.newReportQuery(ProductGroup.class, crit);
q.setAttributes(new String[] { "groupName", "sum(allArticlesInGroup.stock)", 
"sum(allArticlesInGroup.price)" });
q.addGroupBy("groupName");
q.setPathClass("allArticlesInGroup",Article.class);

when i use crit.setPathClass i get all extents of class Article.

jakob

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: OJB : setPathClass

Posted by Phil Warrick <ph...@mcgill.ca>.
Hi Jakob,

Sorry, just noticed your post.

Interesting, I had assumed that setPathClass(classX) or 
addPathClass(classX) would also include the extents of classX. 
Otherwise if you do want an entire subclass tree extent you need to add 
each sub (and sub-sub ...) class explicitly.  I agree that it is useful 
to desire only instances of a certain class without subclasses, but what 
should the default behaviour be?  Maybe there should there be flags or 
extra methods to do either easily?

Phil

Jakob Braeuchi wrote:
 > hi phil,
 >
 > there's a difference between using setPathClass on query and on criteria
 > level.
 > imo this is important for report queries where selected column can be
 > influenced.
 >
 > in the following sample i use q.setPathClass to get only Articles
 > without extents:
 >
 > Criteria crit = new Criteria();
 > Collection results = new Vector();
 > ReportQueryByCriteria q =
 > QueryFactory.newReportQuery(ProductGroup.class, crit);
 > q.setAttributes(new String[] { "groupName",
 > "sum(allArticlesInGroup.stock)",
 > "sum(allArticlesInGroup.price)" });
 > q.addGroupBy("groupName");
 > q.setPathClass("allArticlesInGroup",Article.class);
 >
 > when i use crit.setPathClass i get all extents of class Article.
 >
 > jakob
 >


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org