I use a base entity class for all my entities. It maps to a table that contains columns shared by all entities.
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
@DiscriminatorColumn(name="entpcd", discriminatorType=DiscriminatorType.STRING)
@Table(name="enrg")
public abstract class BaseEntity
@Id
@Column(name="enid")
private String entityId=null;
And I have an entity class that represents a Person, mapped to its own table.
@Entity
@DiscriminatorValue("PN")
@Table(name="pn")
public class Person extends BaseEntity
ENRG table structure
enid, col2, col3
PN table structure
pnid, col2 col3
While retrieving a Person, Hibernate fails trying to do a join on enrg.enid=pn.enid
. How do I override id mapping in Person to have Hibernate join on enrg.enid=pn.pnid
?