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 "Guerrero, Axel" <ag...@SARK.COM> on 2004/03/24 20:12:35 UTC

1 - many without a unique key...

I have two tables (let's say person and address) .. there is a 1 to many relationship (one person, many addresses)
however, the address table does not have a PK (it does have a FK to person id)..
the layout is similar to:

Person
------------------
person_id varchar(10) not null primary key
first_name varchar(20)
last_name varchar(20)
....


Address
--------------
person_id varchar(10)  // points back to person table
address_line_1 varchar(20)
city varchar(20)
....


I do have a collection relationship from person to address through person_id... defined as follows

<collection-descriptor
	name="addresses"
	element-class-ref="com.axel.Address"
	auto-retrieve="true"
	auto-update="false"
	proxy="true"
>
	<inverse-foreignkey field-ref="personId"/>
</collection-descriptor>

The problem is that if I query for a person object, I get N copies of the same address instead of N different addresses.

I have no option to modify the tables as they are used in numerous different applications.
Is there anything that I can try?

Axel Guerrero


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