[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - list's of composite-element's of Hibernate with Java Persist
cwulf
do-not-reply at jboss.com
Sat Dec 30 08:21:21 EST 2006
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#3996964
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3996964
More information about the jboss-user
mailing list