FAQ
Hi everybody,

I'm trying to create a model which uses multiple levels of inheritance. Because of this, I use many (flattened) 1:n-relationships between tables and subtables. Unfortunately, this results in read-only relationships on deeper levels of the hierarchy.
Is there any possibility to establish such a read-only relationship with Cayenne? Otherwise the model is practically unusable as I have no existing data and solely want to create it through the ORM.
I wonder if there is any practical reason why flattened relationships are read-only? Or is only the implementation to handle these lacking? Technically it should be possible to make them writable, at least if the flattened relationship spans only foreign key constraints.


Regards,

Joerg

Search Discussions

  • Aristedes Maniatis at Mar 22, 2012 at 9:38 pm

    On 23/03/12 2:40 AM, Schönfisch, Jörg wrote:
    Hi everybody,

    I'm trying to create a model which uses multiple levels of inheritance. Because of this, I use many (flattened) 1:n-relationships between tables and subtables. Unfortunately, this results in read-only relationships on deeper levels of the hierarchy.
    Is there any possibility to establish such a read-only relationship with Cayenne? Otherwise the model is practically unusable as I have no existing data and solely want to create it through the ORM.
    I wonder if there is any practical reason why flattened relationships are read-only? Or is only the implementation to handle these lacking? Technically it should be possible to make them writable, at least if the flattened relationship spans only foreign key constraints.

    Since you have a special knowledge of your schema that Cayenne doesn't, perhaps you can write your own helper methods which know how to create the intermediate tables and all their required attributes. If the intermediate tables contain only foreign keys and nothing else, then Cayenne could potentially do what you want. But that often isn't the case.


    Ari



    --
    -------------------------->
    Aristedes Maniatis
    GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A
  • Schönfisch, Jörg at Mar 23, 2012 at 11:06 am
    I only need a writable flattened 1:n-ObjRelationship along a foreign key. Technically this should even be easier than a n:m-relationship.
    Can you provide me a hint on where to look if I want to implement this?


    -----Ursprüngliche Nachricht-----
    Von: Aristedes Maniatis
    Gesendet: Donnerstag, 22. März 2012 22:37
    An: user@cayenne.apache.org
    Betreff: Re: Why are most flattened relationships read-only?
    On 23/03/12 2:40 AM, Schönfisch, Jörg wrote:
    Hi everybody,

    I'm trying to create a model which uses multiple levels of inheritance. Because of this, I use many (flattened) 1:n-relationships between tables and subtables. Unfortunately, this results in read-only relationships on deeper levels of the hierarchy.
    Is there any possibility to establish such a read-only relationship with Cayenne? Otherwise the model is practically unusable as I have no existing data and solely want to create it through the ORM.
    I wonder if there is any practical reason why flattened relationships are read-only? Or is only the implementation to handle these lacking? Technically it should be possible to make them writable, at least if the flattened relationship spans only foreign key constraints.

    Since you have a special knowledge of your schema that Cayenne doesn't, perhaps you can write your own helper methods which know how to create the intermediate tables and all their required attributes. If the intermediate tables contain only foreign keys and nothing else, then Cayenne could potentially do what you want. But that often isn't the case.


    Ari



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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriescayenne
postedMar 22, '12 at 3:40p
activeMar 23, '12 at 11:06a
posts3
users2
websitecayenne.apache.org

People

Translate

site design / logo © 2022 Grokbase