Ok to make that even simpler...
There is a class named Address { String line1,line2,city,state;}
Now i also have a POJO named Person and Organization.
Person and Organization can both have multiple addresses just like you can have many residences and the way my company has many offices :-)
The Person class has a reference of Address type in it
Code:
class Person
{
Address myAddress[];
......
}
Code:
class Organization
{
Address orgAddress[];
......
}
All addresses related to Person are stored in table PersonAddress and addresses related to Organization are stored in table OrganizationAddress.
Both PersonAddress and OrganizationAddresses store same columns.
So is it possible that I use only 1 datatype of Address POJO instead of using two seperate Hibernate POJO's for PersonAddress and OrganizationAddress ?