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 Tino Schöllhorn <t....@plattform-gmbh.de> on 2004/12/11 23:22:47 UTC

Deleting Main-Object and its association-objects

Hi,

I have 3 classes which model the "association"-class pattern. Persons 
can take part in many Projects with a special role. With that in mind I 
have the following classes:

Person {
	Collection projectPersons;
}

ProjectPerson {
	Person p;
	Project pr;
	String role;
}

Project {
	Collection projectPersons;
}


These classes are mapped to OJB and everything works fine. Except one 
thing: I want to delete a Person object. When deleting this object I'd 
like that the corresponding ProjectPerson-Objects are deleted as well 
(i.e. removed from the database). With that use-case I have a problem. 
When deleting a Person-Object which has 2 associated Projects OJB 
deletes only 1 (!!) ProjectPerson-Object. Here is a part of my 
repository_user.xml file:

<class-descriptor class="kos.intranet2.om.Person" table="Person">
...
	<!-- ProjectPerson -->
	<collection-descriptor
		name="projectPersons"
			 
collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
		element-class-ref="kos.intranet2.om.ProjectPerson"
		auto-retrieve="true"
		auto-update="object"
		auto-delete="object"
		proxy="true">
		
		<inverse-foreignkey field-ref="personId"/>	
		<attribute attribute-name="reverseReference" attribute-value="person"/>
	</collection-descriptor>
...
</class-descriptor>

What irritates me is the fact that OJB is deleting one of my references 
but not all of them. Currently I am using CVS version of OJB of the 
OJB_1.0_RELEASE Branch of yesterday.

Am I missing something or could this be an error of OJB?

Tino






---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org