Re: Relationships of unsaved object

From: Michał Morzywołek (nirwan8..mail.com)
Date: Thu Jun 05 2008 - 09:48:42 EDT

  • Next message: Aristedes Maniatis: "Re: Relationships of unsaved object"

    Thank you for your help.

    Of course i know about the newObject() method and so on :)
    What im really trying to do is to separate Caynne from POJOs so i could set
    up "clear" DAO layer.
    I wanted to have "saving" instructions in the DAO objects - i was going to
    use "registerObject()" method - and this is where the problems with
    relationships begin.
    I just have to registrate object to Cayenne before doing anything.In my
    (maybe dumb) opinion is not exackly how DAO layer should work (have to
    "save" object before doing anything).

    As far as i understand Hibernate was created to fit DAO model - and it works
    perfectly.
    Cayenne seems to have very different architecture in this matter. With the
    need of registering the new objects in Cayenne (at the start) it's hard to
    create perfectly "sterile" DAO layer.
    It is possible but its much slower then using newObject() method and just
    "mixing it all".
    Cayenne wasn't created to work with "sterile" DAO layer, was it?:)

    Regards,
    Mike

    2008/6/5 Aristedes Maniatis <ari@ish.com.au>:

    >
    > On 05/06/2008, at 10:34 PM, Michał Morzywołek wrote:
    >
    > Person p=new Person(); //not registered in cayenne
    >>
    >> after doing that i can't set any relationships (like with the address).
    >> (1)
    >>
    >> After i register Person p in Cayenne i can set up relationships but only
    >> with registered objects. (2)
    >>
    >> Is there any way to do such things? (1)(2)
    >> Or it is supposed to be like that?
    >>
    >
    > You will need to create your new object like this:
    >
    > Person p = (Person) context.newObject(Person.class);
    >
    >
    > Cayenne 3 does have the ability to work with POJOs, but traditional Cayenne
    > API differs from Hibernate in this important way. Have a look at
    > http://cayenne.apache.org/doc/tutorial-dataobjects.html for more
    > information.
    >
    > Ari Maniatis
    >
    >
    >
    > -------------------------->
    > ish
    > http://www.ish.com.au
    > Level 1, 30 Wilson Street Newtown 2042 Australia
    > phone +61 2 9550 5001 fax +61 2 9550 4001
    > GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Thu Jun 05 2008 - 09:49:16 EDT