hi jay,
this is a feature of the RemovalAwareCollection. it tries to delete all removed items from the database.
jakob
Jay Sissom schrieb:
Hello, we have a mapping with a 1:m relation in it:
<class-descriptor class="edu.iu.uis.pur.req.bo.Requisition" table="PUR.PUR_REQS_T"> <field-descriptor column="REQS_ID" jdbc-type="INTEGER" name="id" primarykey="true" sequence-name="PUR.REQS_ID" autoincrement="true"/> ... many other fields ..... <field-descriptor column="VER_NBR" jdbc-type="INTEGER" locking="true" name="version"/> <collection-descriptor auto-retrieve="true" auto-update="object" auto-delete="object" proxy="true" element-class-ref="edu.iu.uis.pur.req.bo.RequisitionItem" name="items"> <inverse-foreignkey field-ref="requisitionId"/> </collection-descriptor> </class-descriptor>
<class-descriptor class="edu.iu.uis.pur.req.bo.RequisitionItem" table="PUR.PUR_REQS_ITM_T"> <field-descriptor column="REQS_ID" jdbc-type="INTEGER" name="requisitionId" primarykey="true"/> <field-descriptor column="ITM_LN_NBR" jdbc-type="INTEGER" name="itemLineNumber" primarykey="true"/> ....many other fields... <field-descriptor column="VER_NBR" jdbc-type="INTEGER" locking="true" name="version"/> </class-descriptor>
There are times in our process where we add a new item to the items collection in our Requisition, then we delete it before saving the collection.
When we do this, we get an OptimisticLockException because OJB is trying to delete the object that was never in the table. Here is sample code that causes this:
Requisition req = reqService.getRequisitionById(new Integer(1517));
// Add a blank one RequisitionItem ri = new RequisitionItem(); req.getItems().add(ri);
// Remove it req.getItems().remove(ri);
broker.store(req);
Is this because of something we are doing or is it a bug? We're using version 1.0.0.
Thanks Jay
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
