Hello there! I'm using Hibernate 3.3.2, annotations 3.4 and EntityManager 3.4.0
Well, I'm preparing a presentation with some samples, but when I got to Inheritance mapping, Only Table per concrete class work as expected. When mapping table per class hierarchy:
Code:
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(
name = "BILLING_DETAILS_TYPE",
discriminatorType = DiscriminatorType.STRING
)
@Table(name="BILLING_DETAILS")
public abstract class BillingDetails {
@Entity
@DiscriminatorValue("CC")
public class CreditCard extends BillingDetails {
or table per subclass:
Code:
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name="BILLING_DETAILS")
public abstract class BillingDetails {
@Entity
public class CreditCard extends BillingDetails {
I'm always getting an error : javax.persistence.PersistenceException: org.hibernate.AnnotationException: Cannot find the expected secondary table: no CREDIT_CARD available for org.acme.auction.model.CreditCard
I've double checked MasteringEJB 3.0, Java Persistence with Hibernate, and the spec, and It's not mandatory having a @SecondaryTable is this something related to the version I'm using?
Regards