Lihua Cao wrote:
Hi, I got the following problems when update an object using castor.
I have two objects: RoleType and QueueType. They have one field of other type in each attributes. See the mapping files for more details. I got the error in the following scenario (r - RoleType object, q, q2 - QueueType objects):
1. r.initialQ = q
2. q.ownershipRoleType=r,
3. when I call r.setInitialQ(q2), then commit transaction, I got the following error.
org.exolab.castor.jdo.TransactionAbortedException: Nested error: org.exolab.castor.jdo.PersistenceException: Nested error: java.sql.SQLException: Cannot insert the value NULL into column 'roleID', table 'QueueType'; column does not allow nulls. UPDATE fails.
It seems that when updating r, q get updated as well (it makes sense, since
q.ownershipRoleType=r), but somehow r.typeID become null when q is updated.
Castor is not complaining about r.typeID, but q2.roleID.
q2 is a new object, replaces q and don't have roleID set, correct?
If that's the case, just set q2.roleID and problem solved I think.
Stein
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
