Hi,
I am having great difficulty trying to model the following classes using Hibernate. I do feel it may not be possible to do. Please help.
class Address {
... // typical address attributes
}
class CustomerAddress extends Address {
String addressRef; // e.g. home, work, friend
int timeAtAddress;
...
}
class Supplier {
Address address;
...
}
class Customer {
Set addresses;
...
}
A Supplier will have one address.
A Customer will have 1 or more CustomerAddress instances.
(Later, there may be further subclasses of Address)
--------------------------------------------------------
At the database, I would expect something like:
[Supplier] 1 ------------ 1 [Address]
[Customer] 1 ----------<- 1..n [Address(CustomerAddress)]
I have been totally baffled trying to write the Hibernate mapping file(s) for these classes.
The above may not be possible to do. Any help would be greatly appreciated.
I am using Hibernate versation 2.1.1 and may easily use a later version if it helps.
Thanks in advance,
Usman
|