I see now. We have to set a link ourselves (on the many side, in a 1 to many). I assumed that was the role of the persistence layer.
That fixed the problem. I see we also have to call db.create( child ) before adding it to the parent in a many-many relation. That also solved the problem. I hope a caster-user list is created as that would help people like me to learn the ropes and freeing developers up for real work. My most humble apologies for wasting your time..........and many thnaks for your help. Bert. ----- Original Message ----- From: "Thomas Yip" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, January 21, 2002 9:07 PM Subject: Re: [castor-dev] Object reference not made persistent. > > > Well, I took a deeper note. And, I found no problem. > Here what the test case test, with cache set to none. > > create person1 > commit tx > > begin tx > load person1 > new groupA > new groupB > new person2 > links person1 to groupA (both way) > links person2 to groupA and groupB (both way) > commit > > I concluded it is not a bug. > > However, if I "forget" to set a link only one way, then I got what you > reported. > > If you still think it is a bug and want me to investigate further, please > send me a diff of ManyToMany.java locating in src\tests\jdo directory, > which have your addition code to show your problem. Otherwise, I will > not take any further investigation, because I really have no time. > > > > Thomas > > -----Original Message----- > >From: Bert van Brakel [mailto:[EMAIL PROTECTED]] > >Sent: Sunday, January 20, 2002 12:52 PM > >To: [EMAIL PROTECTED] > >Subject: Re: [castor-dev] Object reference not made persistent. > > > >I have identified a similiar problem in thread "Re: [castor-dev] New child > >objects in m:n relation not created in Persistent storage when creating new > >parent + more errors" > > > >I think it may be a bug. I am awaiting a response from Thomas to see what > he > >makes of it. > > > >It could be something to do with the UUID generator, as the problem goes > >away if I set no key-gen and assign my own identifiers before creating in > >persistent storage. > > > >Bert. > > > > > >----- Original Message ----- > >From: "Eduard Mossinkoff" <[EMAIL PROTECTED]> > >To: <[EMAIL PROTECTED]> > >Sent: Monday, January 21, 2002 4:53 AM > >Subject: [castor-dev] Object reference not made persistent. > > > > > >> Howdy > >> > >> I have reduced the problem I experience to the bare essentials. Let me > >> elaborate. > >> Two simple classes called 'A' and 'B'. Both classes have an 'id' of type > >> String. The 'id' is generated by the UUID key-generator. I can persist > >> instances of 'A' and 'B' without problems. > >> Now 'B' has a reference to 'A' and therefor 'B' depends on 'A'. Type 'B' > >> has a property called 'a' of type 'A'. > >> If, in a single transaction, I create an instance of 'A', called 'a1' > >> and an instance of 'B', called 'b1'. Then 'b1' receives a reference to > >> 'a1'. The transaction is committed and without problems so far. > >> > >> Now, I want to have a new instance of type 'B', called 'b2' associated > >> with the persistent instance 'a1' of type 'A'. I retrieve 'a1' from the > >> database and associate 'b2' with 'a1'. The assertions in my TestSuite > >> assures me that 'b1.a' is referring to 'a1'. Then when the transaction > >> is committed, a NULL is inserted for the property 'a' which holds a > >> reference to 'a1'. Instead of storing the 'id' of 'a1', a NULL is > >> inserted. > >> > >> The problem is derived from a larger complex meta-model repository, so I > >> leave out all the irrelevant bits and pieces. > >> > >> It would be great if someone can help me out. Is it my understanding or > >> really a bug, that is what I would like to know. > >> Thanks, > >> Eduard. > >> > >> > >> _________ > >> class A { > >> public String id; > >> .. > >> } > >> > >> class B { > >> public String id; > >> public A a; > >> .. > >> } > >> > >> create table A ( > >> id varchar(30) not null, > >> primary key ( id ) > >> ); > >> > >> create table B ( > >> id varchar(30) not null, > >> a_id varchar(30) not null, > >> primary key ( id ), > >> foreign key (a_id) references A (id) > >> ); > >> > >> > >> <class name="A" identity="Id" key-generator="UUID"> > >> <map-to table="A" xml="A" /> > >> <field name="id" required="true" direct="true"> > >> <sql name="id" /> > >> <bind-xml name="id" node="attribute"/> > >> </field> > >> </class> > >> > >> <class name="B" identity="Id" key-generator="UUID"> > >> <map-to table="B" xml="B" /> > >> <field name="id" required="true" direct="true"> > >> <sql name="id" /> > >> <bind-xml name="id" node="attribute"/> > >> </field> > >> <field name="a" type="A" required="true" direct="true"> > >> <sql name="a_id" dirty="check" /> > >> <xml name="a" node="element" /> > >> </field> > >> </class> > >> > >> ----------------------------------------------------------- > >> If you wish to unsubscribe from this mailing, send mail to > >> [EMAIL PROTECTED] with a subject of: > >> unsubscribe castor-dev > > > > > >_________________________________________________________ > >Do You Yahoo!? > >Get your free @yahoo.com address at http://mail.yahoo.com > > > >----------------------------------------------------------- > >If you wish to unsubscribe from this mailing, send mail to > >[EMAIL PROTECTED] with a subject of: > > unsubscribe castor-dev > > > > ----------------------------------------------------------- > If you wish to unsubscribe from this mailing, send mail to > [EMAIL PROTECTED] with a subject of: > unsubscribe castor-dev _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
