[jboss-user] [EJB 3.0] - Re: In relation to Entity hierarchy and EntityManager's beha

fhh do-not-reply at jboss.com
Sun Apr 29 06:21:44 EDT 2007


I think this is a misunderstanding but it is difficult to explain.

 The JOINED strategy does not directly relate to the class hierachy because the class hierachy is about classes and their relationships while the persitence api deals with instances of classes. Therefore entities cannot "share" the rows in the classes of tables they have inherited.

Maybe an example makes it easier to understand: Imagine the (abstract) class Vehicle had a property license_number that is inherited up to the Boieng 747. It is not sufficient to have one license plate number for all Vehicles (it is not a static property), so you have to have one row in the vehicle table for every vehicle.

If you want to have one entry in the parent table for all the children use ManyToOne on the "child" instead of inheritance.

Regards

Felix

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4041693#4041693

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4041693



More information about the jboss-user mailing list