Quote:
A rewording of the question is as follows:
What GeneratedValue strategy should be used on an abstract parent class that is defined as Inheritance strategy InheritanceType.TABLE_PER_CLASS, such that the parent and children each have separate tables with no duplicated columns?
Answering that question:
Hibernate Annotations Reference Guide tells us (see
bold):
http://docs.jboss.org/hibernate/stable/ ... tml#d0e849Quote:
2.2.4.1. Table per class
This strategy has many drawbacks (esp. with polymorphic queries and associations) explained in the EJB3 spec, the Hibernate reference documentation, Hibernate in Action, and many other places. Hibernate work around most of them implementing this strategy using SQL UNION queries. It is commonly used for the top level of an inheritance hierarchy:
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Flight implements Serializable {
This strategy support one to many associations provided that they are bidirectional. This strategy does not support the IDENTITY generator strategy: the id has to be shared across several tables. Consequently, when using this strategy, you should not use AUTO nor IDENTITY.