Werner Guttmann wrote:
On Sun, 20 Feb 2005 15:06:17 +0100, Emir Causevic wrote:
3. Third and most important to me is on proper way of adding Parts (because they depend of Items due to 1:M). Can I add part like this:
Item i = db.load(...); Part p = new Part(....); p.setItem(i); db.create(p); db.commit()
What is the proper way of adding many-side objects?
Practically, it should not make a differnce whether you set the Item (paren) on the part or the other way around. You could try ...
Item i = db.load(...); Part p = new Part(....); db.create(p); i.addPart (p); db.commit()
Please note that the db.create() should be before the i.add() in case you are using a key generator.
Wouldn't it be better to just add the parts and update item: Item i = db.load(...); Part p = new Part(....); // db.create(p); i.addPart (p); db.commit()
You are not supposed to call create on items that have the depends-attribute in the mapping-file.
Perhaps you could post the mapping file?
Stein
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user
