cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <>
Subject Re: Building Expression on the fly and many to many problems
Date Wed, 12 Jul 2006 14:49:34 GMT
This is a limitation per CAY-514, that is high on the 3.0 priority list:

One possible way around it (if I understand your schema correctly) is  
to do a fetch on a join table (role?), and then manually build a set  
of unique transactions from a list of matched roles. The last part  
should be fairly easy, since Cayenne guarantees object uniquing in  
the same context.


On Jul 12, 2006, at 10:18 AM, Eric Bianchi wrote:

> Hello list,
> I'm building a small application in Tapestry / Cayenne which involves
> transactions and people playing a role in a transaction. People /
> Transaction is a many to many relationship with a role in between.
> I'm trying to dynamically build queries on transactions, choosing
> people and role in a list and get all transactions corresponding to
> these criteria. So basically, I create my Expressions on the fly using
> expression.fromString(object path) and I join all my Expressions with
> the andExp method.
> With more than 1 person, I have 0 transaction as result. Cayenne is
> actually building a SQL Query with only one  TransactionPerson  in the
> FROM  although i'd like to see something like
> SELECT ...
> FROM Transaction t0, TransactionPerson t1, TransactionPerson t2,
> TransactionPerson t3 ...
> WHERE t1.person_id = ? and t2.person_id = ? and t3.person_id = ?
> with as much as TransactionPerson than people choosen by the user.
> I've tried to use addPrefetch on TransactionPerson with
> Any tips or idea ?
> Thanks in advance
> -- 
> Eric Bianchi <>

View raw message