This is a limitation per CAY-514, that is high on the 3.0 priority list:
http://issues.apache.org/cayenne/browse/CAY-514
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.
Andrus
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
JOINT_PREFETCH_SEMANTICS with no success
Any tips or idea ?
Thanks in advance
--
Eric Bianchi <[EMAIL PROTECTED]>