You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Eric Kelm <er...@vsgadmin.com> on 2005/10/20 18:53:38 UTC
1:n mapping update problem
I am having a problem with using a 1:N mapping in OJB. I have a main object,
ServiceTicket, which has multiple Note objects in a collection. When I
retrieve the ServiceTicket object, all the correct Note objects are in the
Vector notes, which is an attribute of the ServiceTicket. The problem comes
during an update. When I update the ServiceTicket, all new Notes are
inserted into the table, but the original Notes are still there. So, if I
retrieve 2 Notes relating to ServiceTicket, when I update, I now have 4. I
am using the ODMG-API. Thanks for any help in advance.
Repository.xml snippet:
<class-descriptor
class="com.xxx.xxxxxxxxx.businessobjects.ServiceTicketBO"
table="service_tickets"
isolation-level="read-uncommitted"
>
<field-descriptor
name="id"
column="idSERVICE_TICKET"
jdbc_type="INTEGER"
primarykey="true"
access="readonly"
autoincrement="true"
/>
...
More field descriptors
...
<collection-descriptor
name="notes"
element-class-ref=
"com.
xxx.xxxxxxxxx.businessobjects.ServiceTicketNoteBO"
proxy="false"
auto-retrieve="true"
auto-update="none"
auto-delete="none"
orderby="id"
sort="ASC">
<inverse-foreignkey field-ref="idServiceTicket" />
</collection-descriptor>
</class-descriptor>
<class-descriptor
class="com.xxx.xxxxxxxxx.businessobjects.ServiceTicketNoteBO"
table="service_ticket_notes"
isolation-level="read-uncommitted"
>
<field-descriptor
name="id"
column="idSERVICE_TICKET_NOTES"
jdbc_type="INTEGER"
primarykey="true"
access="readonly"
autoincrement="true"
/>
<field-descriptor
name="idServiceTicket"
column="idSERVICE_TICKET"
jdbc_type="INTEGER"
/>
...
More field descriptors
...
</class-descriptor>
---------
Eric Kelm
Developer, VSG Worldwide LLC
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org