Building Expression on the fly and many to many problems

From: Eric Bianchi (erbianch..mail.com)
Date: Wed Jul 12 2006 - 10:18:09 EDT

  • Next message: Andrus Adamchik: "Re: How to share no committed objects between sessions"

    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 <erbianch..mail.com>
    



    This archive was generated by hypermail 2.0.0 : Wed Jul 12 2006 - 10:25:44 EDT