[appengine-java] Re: JDO: Null parent on some children objects

2010-08-31 Thread cghersi
ok, thanks. The second answer is dictated by the fact that I don't want null values to be returned from getter methods, otherwise I cannot safely do an operation like: mySecondObject.getTags().add(tag); as I need to check if getTags() has returned null. So, which is the best in your opinion between

[appengine-java] Re: JDO: Null parent on some children objects

2010-08-30 Thread Frederik Pfisterer
while if I understood your explanation I don't have to invoke pm.makePersistent() on mySeconObject, is it? - correct, it is automatically saved with the parent. The other answer depends on the use case, but it appears to be very bad style to produce an "owner"/parent in the child object... childr

[appengine-java] Re: JDO: Null parent on some children objects

2010-08-27 Thread cghersi
Hi Frederik! Sorry for my ignorance, I tougth that the right way to save a Second object was: pm.makePersistent(mySecondObject); myFirstObject.getList().add(mySecondObject); pm.makePersistent(myFirstObject); while if I understood your explanation I don't have to invoke pm.makePersistent() on myS

[appengine-java] Re: JDO: Null parent on some children objects

2010-08-27 Thread Frederik Pfisterer
Hi, the problem is this line: owner = new First(); Beware that the only way you should ever store a Second object is: myFirstObject.getList().add(mySecondObject); pm.makePersistent(myFirstObject); since Second.owner is mapped it's automatically populated by the persistance manager. Hope this he

[appengine-java] Re: JDO: Null parent on some children objects

2010-08-26 Thread cghersi
Hi Diego, thank you but unfortunately I strictly followed what stated in that page, and the result is the problem I posted!! Any other hint? Thank you very much, Best Cghersi On 26 Ago, 16:09, Diego Fernandes wrote: > Hi, > i may find something > herehttp://code.google.com/intl/en/appengine/d

[appengine-java] Re: JDO: Null parent on some children objects

2010-08-26 Thread Diego Fernandes
Hi, i may find something here http://code.google.com/intl/en/appengine/docs/java/datastore/relationships.html []'s Diego On 26 ago, 04:42, cghersi wrote: > Hi everybody, > > I'm struggling with a strange problem with JDO. > I've got two PersistenCapable classes, one having a Collection of > o