Werner,
I've tested again and againg.
See inline...

> >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);
        // i.setLastUpdate(new Date());
> >     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 ...

I've tried and it works only as I've written above.

> 
> Item i = db.load(...);
> Part p = new Part(....);
> db.create(p);
> i.addPart (p);
> db.commit()
This will not work, and the create(p) will fail with the message that 
parts.itemID cannot be null.

Another, IMO, silly thing is that I can not update a field in the Items object 
during this transaction.
If i try to, e.g. call i.setLastUpdate(new Date()), the commit() of the 
transaction will hang.
Is this OK?! I don't think it is...


> 
> Please note that the db.create() should be before the i.add() in 
> case you are using a key generator.
> 

This doesn't work, create will fail.

Regards,
Emir



----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-user

Reply via email to