Using Hibernate 3 i could define composite-elements like @Embeddable with Java
Persistence.
But Hibernate also allows collections of those composite-element's.
| <class name="entity.Company">
| ...
| <list name="company_addresses">
| <key column="id"/>
| <list-index column="no"/>
| <composite-element class="entity.Address">
| <property name="street"/>
| ...
| </composite-element>
| </list>
| ...
| </class>
|
| <class name="entity.Freelancer">
| ...
| <list name="freelancer_addresses">
| <key column="id"/>
| <list-index column="no"/>
| <composite-element class="entity.Address">
| <property name="street"/>
| ...
| </composite-element>
| </list>
| ...
| </class>
|
That way i could use an entity like Address in multiple tables linked with several other
entities without unnecessary inheritance like CompanyAddress extends Address and
FreelancerAddress extends Address or even a kind of polymorphism like Company extends
Addressable and Freelancer extends Addressable...
Is it possible to design such a mapping with EJB 3 annotations?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3996964#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...