| In Hibernate 3.5, inheritance using JPA single-table strategy seems to break. The same code was tested successfully using Hibernate 3.4.
 The code is like this. The base entity class is Customer, which is mapped to table CUSTOMER. The column CUSTOMER_TYPE is the discriminator. When it is “C”, it is a regular Customer, When it is “P”, it is a PreferredCustomer.
 
 @Entity
 @Table(name = "CUSTOMER")
 @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
 @DiscriminatorColumn(name = "CUSTOMER_TYPE",
 discriminatorType = DiscriminatorType.STRING, length = 1)
 @DiscriminatorValue(value = "C")
 public class Customer {
 @Id
 @GeneratedValue(strategy = GenerationType.TABLE,
 generator = "CUST_SEQ_GEN")
 @Column(name = "CUSTOMER_ID_PK", updatable=false)
 protected int customerId;
 
 @Column(name = "CUSTOMER_TYPE", nullable=false)
 @Enumerated(EnumType.STRING)
 protected CustomerType customerType;
 
 // .. …..
 }
 
 @Entity
 @DiscriminatorValue(value = "P")
 public class PreferredCustomer extends Customer {
 // ...
 }
 
 With the mapping above, Hibernate 3.5 gives me the following error when reading the annotations during initialization:
 
 org.hibernate.MappingException: Repeated column in mapping for entity: jpatest.entity.PreferredCustomer column: CUSTOMER_TYPE (should be mapped with insert="false" update="false")
 
 Note that the customerType attribute is defined in the base entity Customer, and the derived entity PreferredCustomer should inherit it as is. This same code runs well with Hibernate 3.4 and EclipseLink.
 
 I am wondering if this is a bug introduced in Hibernate 3.5?
 
 
 |