[OJB-developers] Storing references (or updating collections on referenced objects) -> defining the
Brought to you by:
thma
From: Leandro R. S. C. <le...@ib...> - 2002-06-17 18:04:19
|
Hi all. this email is mainly for MBAIRD because of his comments in PBImpl.java I'm trying to store and object that should be part of a collection of another object but the collection is not updated by PBImpl.java. To make it more concrete here is an example <class-descriptor class="Project" table="PROJECT"> <field-descriptor id="1" name="id" column="PROJECT_ID" jdbc-type="INTEGER" primarykey="true" autoincrement="true"/> <collection-descriptor name="users" element-class-ref="User" auto-retrieve="true" auto-update="false" auto-delete="true"> <inverse-foreignkey field-id-ref="2"/> </collection-descriptor> </class-descriptor> <class-descriptor class="User" table="USER"> <field-descriptor id="1" name="id" column="USER_ID" jdbc-type="INTEGER" primarykey="true" autoincrement="true"/> <field-descriptor id="2" name="project_id" column="PROJECT_ID" jdbc-type="INTEGER"/> <reference-descriptor name="project" class-ref="Project" auto-retrieve="true" auto-update="true"> <foreignkey field-id-ref="2" /> </reference-descriptor> </class-descriptor> When I add a User to a existing Project the collection users in Project is not updated by PBImpl.java. When I was looking up PBImpl src I saw a comment in asserFKAssignment() : /** * MBAIRD * we have 'disassociated' this object from the referenced object, the object representing the ord is now null, * so set the fk to null. * * Note: I can't believe this wasn't tested (as of June9/2002), attaching and removing objects seems to be a * pretty important piece of functionality. * */ I don't understand if PBImpl should update collections on referenced objects or we must do it by hand ? Can some help me define the correct behavior ? -- Leandro Rodrigo Saad Cruz IT - Inter Business Tecnologia e Servicos (IB) http://www.ibnetwork.com.br |