The difference's I've noticed are: 1) I have a mixture of lazy-loaded property types (1:1 and 1:many) on a single object being created/updated 2) My lazy-loaded independent object graph extends beyond a simple parent-->child So maybe TC166 answers some of my questions about independent objects...based on TC166, it looks like you have to load atleast all the "direct" lazy-loaded, independent properties. So, the first set of code (repeated below) would *NOT* work. db.begin(); Property1 propertyOne = db.load(Property1.class, prop1Id); Property2 propertyTwo = db.load(Property2.class, prop2Id); db.commit();
Parent parent = new Parent(); parent.setProperty1(propertyOne); parent.setProperty2(propertyTwo); db.begin(); db.create(parent); db.commit(); I could see this being required for "dependent" objects, but I'm not quite sure why this required for "independent" objects. It's very likely these independent objects were loaded and are in the cache so the performance hit isn't terrible, but it seems like for independent objects Castor could simply take the ID value of the lazy-loaded property without loading it. Maybe a "autostore" flag similar to what controls dependent objects is needed... Jon ----- Original Message ---- From: Werner Guttmann <[EMAIL PROTECTED]> To: [email protected] Sent: Monday, March 20, 2006 1:37:16 PM Subject: Re: [castor-user] [JDO] PersistenceException while creating object with lazy-loaded independent objects Ralf, yes, I have, and I have been looking at 1355 quite some time today. What actually escapes me is how come TC166 does not fail, whereas CASTOR-1355 does ? Especially as Jon's code is almost identical to what TC166 tries to test. Werner PS What I did come to realize is that there's two copies of the LazyCGLIB interface .. ;-) Ralf Joachim wrote: > Werner, if you have not recoginzed, Jon created issues 1355 and 1365 for > his problems. > > Ralf > > > Werner Guttmann schrieb: >> Jon, >> >> it might be worthwhile to have a look at the Castor JDO test case in >> src/tests/jdo/tc166, which holds example code and various tests related >> to the use of lazy loading. >> >> Having said that, I'll get back to you later on with some more answers. >> >> Werner >> >> Jon Wilmoth wrote: >> >>> BTW...what's the *expected* requirement for creating/updating objects >>> with lazy-loaded independent objects? >>> Do I need to load any direct lazy-loaded, independent objects? For >>> example would this work? If not why? What if Property1 defined a >>> direct lazy-loaded, independent object (i.e. Property3)? >>> >>> db.begin(); >>> Property1 propertyOne = db.load(Property1.class, prop1Id); >>> Property2 propertyTwo = db.load(Property2.class, prop2Id); >>> db.commit(); >>> >>> Parent parent = new Parent(); >>> parent.setProperty1(propertyOne); >>> parent.setProperty2(propertyTwo); >>> >>> db.begin(); >>> db.create(parent); >>> db.commit(); >>> >>> >>> Do I have to load all direct independent objects? For example would >>> this work? If not why? What if Property1 defined a direct >>> lazy-loaded, independent object (i.e. Property3)? >>> >>> Parent parent = new Parent(); >>> db.begin(); >>> parent.setProperty1(db.load(Property1.class, prop1Id)); >>> parent.setProperty2(db.load(Property2.class, prop2Id)); >>> db.create(parent); >>> db.commit(); >>> >>> Some hybrid? >>> >>> Thanks, >>> Jon >>> >>> ----- Original Message ---- >>> From: Ralf Joachim <[EMAIL PROTECTED]> >>> To: [email protected] >>> Sent: Thursday, March 16, 2006 3:50:56 PM >>> Subject: Re: [castor-user] [JDO] PersistenceException while creating >>> object with lazy-loaded independent objects >>> >>> >>> Jon, >>> >>> I'm quite sorry but this sounds to be a bug. Could you please open a >>> new issue in jira following the bug submission guidlines at: >>> >>> http://castor.codehaus.org/how-to-submit-a-bug.html >>> >>> Regards >>> Ralf >>> >>> >>> Jon Wilmoth schrieb: >>> >>>> I'm getting a PersistenceException while trying to create an object >>>> that has lazy-loaded, independent children properties that in turn >>>> have castor lazy-loaded, independent properties. I can't imagine >>>> I'd need to walk the entire tree loading each independent object >>>> when I do a create/update. Is the general flow below supported? Is >>>> this a bug? >>>> >>>> For example the following code: >>>> db.begin(); GolfRound round = new GolfRound(); >>>> round.setCourse(db.load(GolfCourse.class, id)); round.setCourse(new >>>> Date()); db.create(round); db.commit(); db.close(); >>>> fails with org.exolab.castor.jdo.PersistenceException: Object, >>>> [EMAIL PROTECTED], links to another object, [EMAIL PROTECTED] that is not >>>> loaded/updated/created in this transaction: >>>> class GolfRound { private Long id; //lazy-loaded flag set to true in >>>> mapping private GolfCourse course; private Date datePlayed; .... } >>>> class GolfCourse { private Long id; //lazy-loaded flag set to true >>>> in mapping private City city; private Collection teeBoxes; .... } >>>> class City { private Long id; private String name; .... } >>>> Thanks, >>>> Jon >>>> >>>> ------------------------------------------------- >>>> If you wish to unsubscribe from this list, please send an empty >>>> message to the following address: >>>> >>>> [EMAIL PROTECTED] >>>> ------------------------------------------------- >>> >>> ------------------------------------------------- >>> If you wish to unsubscribe from this list, please send an empty >>> message to the following address: >>> >>> [EMAIL PROTECTED] >>> ------------------------------------------------- >>> >>> ------------------------------------------------- >>> If you wish to unsubscribe from this list, please send an empty >>> message to the following address: >>> >>> [EMAIL PROTECTED] >>> ------------------------------------------------- >>> >>> >> >> >> >> ------------------------------------------------- >> If you wish to unsubscribe from this list, please send an empty >> message to the following address: >> >> [EMAIL PROTECTED] >> ------------------------------------------------- >> > > ------------------------------------------------- > If you wish to unsubscribe from this list, please send an empty message > to the following address: > > [EMAIL PROTECTED] > ------------------------------------------------- > > ------------------------------------------------- If you wish to unsubscribe from this list, please send an empty message to the following address: [EMAIL PROTECTED] ------------------------------------------------- ------------------------------------------------- If you wish to unsubscribe from this list, please send an empty message to the following address: [EMAIL PROTECTED] -------------------------------------------------

