-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Cannot find secondary table
PostPosted: Sun Aug 16, 2009 8:12 pm 
Beginner
Beginner

Joined: Tue Dec 21, 2004 11:53 am
Posts: 42
Hello there! I'm trying to reproduce the examples from caveat, but when I try to map a 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  {
   
   @Id
   @GeneratedValue(strategy=GenerationType.AUTO)
   private Integer id;


@Entity
@DiscriminatorValue("CC")
public class CreditCard extends BillingDetails {



But when I try to open my session factory on hibernate view, I get the following error:

Code:
org.hibernate.console.HibernateConsoleRuntimeException: Could not create JPA based Configuration
Could not create JPA based Configuration
  <No message>
  java.lang.reflect.InvocationTargetException
    java.lang.reflect.InvocationTargetException: <no message>
    java.lang.reflect.InvocationTargetException
    javax.persistence.PersistenceException: org.hibernate.AnnotationException: Cannot find the expected secondary table: no CREDIT_CARD available for org.acme.auction.model.CreditCard
    org.hibernate.AnnotationException: Cannot find the expected secondary table: no CREDIT_CARD available for org.acme.auction.model.CreditCard
    org.hibernate.AnnotationException: Cannot find the expected secondary table: no CREDIT_CARD available for org.acme.auction.model.CreditCard
    Cannot find the expected secondary table: no CREDIT_CARD available for org.acme.auction.model.CreditCard



Now, according to the spec I should not need the secondary table annotation on my descendant class right? Checking the code from the app it does declare an @SecondaryTable, but not at the book, or other sources. Can't figure out why does Hibernate would need a SecondaryTable on a strategy mapped to use just a single table?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.