|
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.
Any one has any hint? Really, really appreciated!!!! Thanks. Lihua
-------------------------------------------------------------------------------------------- <mapping> <class name="com.abc.RoleType" identity="typeID" key-generator="IDENTITY"> <map-to table="RoleType" />
<field name="typeID"> <sql name="typeID" /> </field>
<field name="initialQ" type="com.abc.QueueType" > <sql name="initialQueueID"/> </field> </class> </mapping>
<mapping> <class name="com.abc.QueueType" identity="typeID" key-generator="IDENTITY" > <map-to table="QueueType"/>
<field name="typeID"> <sql name="typeID"/> </field> <field name="ownershipRoleType" type="com.abc.RoleType"> <sql name="roleID"/> </field> </class> </mapping> |
- Re: [castor-dev] update object failed when there is re... Lihua Cao
- Re: [castor-dev] update object failed when there ... Stein M. Hugubakken
