Emir,

as your relation is of type 1:M, can you please set both sides of the relation, 
i.e. use

a) item.setObeSideObject(c);, and
b) c.addItem (item).

In other words, by definition all 1:many relations in Castor are bi-directional.

Regards
Werner

-----Urspr�ngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 23. Februar 2005 15:12
An: [email protected]
Betreff: [castor-user] [JDO] Problems with one to many



I'm trying to insert the object that's on the M side of the 1:M relation. 
I'm doing it this way:
db = jdo.getDatabase();
db.begin();
c = (OneSideObject)db.load(OneSideObject.class, new Integer(osoID));
itemsCount = c.getItems().size(); //these are lazy loaded, but I can check the 
size
someNumber = c.getSomeNumber();
item.setOneSideObject(c);
//c.setLastUpdate(new Date());  <--- Castor hangs if I uncomment this
db.create(item);
db.commit();
db.close();

If I run it this way everything is alright, but if I uncomment the line where I 
update the OneSideObject object, castor Waits for that object, like:

[org.exolab.castor.persist.ObjectLock] - Waiting on OneSideObject/2/2 R/- by 
[EMAIL PROTECTED]


Regards,
Emir



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

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

Reply via email to