I'm mapping an object to two data sources. Data source one is normalized, so:
Code:
===== PERSON ======
ID | NAME
-------------------
1 | Joe
==== PERSON_PHONE ====
PERSON_ID | PHONE_ID
----------------------
1 | 1
====== PHONE ======
ID | PHONE_NUMBER
-------------------
1 | 111-111-1111
Data source two is not normalized...
Code:
===== PERSON ==============
ID | NAME | PHONE_NUMBER
---------------------------
1 | Joe | 111-111-1111
I'd like to map a Person object with a property called
phoneNumbers, which is a set of PhoneNumber ojbects:
Code:
class Person {
...
private Set phoneNumbers;
public void setPhoneNumbers(Set set) { ... }
public Set getPhoneNumbers { ... }
...
}
I know how to do this with the normalized schema:
Code:
<class name="Person" table="PERSON">
...
<set name="phoneNumbers" table="PERSON_PHONE">
<key column="PERSON_ID"/>
<many-to-many column="PHONE_ID" class="Phone"/>
</set>
...
</class>
How do I map PHONE_NUMBER as a Set with with the denormalized schema?
Hibernate version: 2.1.7c