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]
-------------------------------------------------