At 11:11 +0200 10/2/03, LAURENT Stephane wrote:
you can getCollection of A where listOfA contain at lesat one element equal to wantedAInstance :

crit.addEqual("listOfA",wantedAInstance);
getCollectionbyCriteria(A.class,crit);

you can getCollection of A where listOfA contain at lesat one element A having at least A in his listOfA collection :

crit.addEqual("listOfA.listOfA",wantedAInstance);
getCollectionbyCriteria(A.class,crit);

Yes, this is it. To be honest, I went ahead and tried what seemed like the intuitive syntax before I saw your reply, and I was pleased to see it work. Knowing now that it works, I can understand the approach the framework takes to building the SQL, but I was hung up on trying to imagine more pure property access. That is, in my case, my query is something like this:


crit.addIn("items.categoryCode", categories)

Since "items" is a list, obviously it doesn't have a property "categoryCode". Its members have that category, but at first I thought I would at least need to somehow specify an index -- i thought it might be something like
crit.addIn("items[*].categoryCode", categories)


Of course, now I see that OJB knows that "items" is a collection, not a field, and so it can interpret what comes after items (.categoryCode) differently than it would in a 1:1 join.

Thanks for your reply,
        Joe

--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "We want beef in dessert if we can get it there."
-- Betty Hogan, Director of New Product Development, National Cattlemen's Beef Association



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to