Re: Using Join Table

From: Nishant Neeraj (nneeraj12..ahoo.com)
Date: Fri Sep 11 2009 - 04:56:03 EDT

  • Next message: Arnaud Garcia: "getThreadObjectContext with domain parameter - code -"

    I will try. Was a bit afraid because the Index page of Cayenne says "3.0 (in development)"

    I wanted to do something like  this

    select m.*, s.subscription_type from magazines m, subscriptions s where m.mag_id = s.mag_id and s.reader_id = <readerID>;

    The returned result set would be stored in List<Magazine>

    Is something like this doable?

    One thing, I wanted to get addressed is to have foreign key in dependent table (explicitely in a separate column) and still have ability to ensure that dependent record gets deleted when master record is being deleted. Some kind of "on delete cascade" feature.

    Thanks
    Nishant

    --- On Fri, 11/9/09, Aristedes Maniatis <ar..aniatis.org> wrote:

    From: Aristedes Maniatis <ar..aniatis.org>
    Subject: Re: Using Join Table
    To: use..ayenne.apache.org
    Date: Friday, 11 September, 2009, 4:40 AM

    On 10/09/09 8:04 PM, Nishant Neeraj wrote:
    > I am new to ORM and Cayenne. I a pretty puzzled by relationship flattening and the way we use Modeller to achieve this.[1]

    You may be confused by the different versions of Cayenne. You say you are using Cayenne 2, but you refer to the docs from 1.2. I would recommend that you try Cayenne 3 (M6) which is perfectly stable and in use in production. The modeler is greatly improved in that version and you might find the things you are trying to do clearer.

    From your description it appears to me that flattening the relationship isn't the right thing for you. That is normally done when the join table has no information you care about, but in this case 'subscriptions' is a table with other data you need to access.

    Ari Maniatis

    -- 
    -------------------------->
    Aristedes Maniatis
    GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
    



    This archive was generated by hypermail 2.0.0 : Fri Sep 11 2009 - 04:56:42 EDT