-->
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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate needs Second table for any type of mapping
PostPosted: Sun Aug 16, 2009 9:18 pm 
Beginner
Beginner

Joined: Tue Dec 21, 2004 11:53 am
Posts: 42
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


Top
 Profile  
 
 Post subject: Re: Hibernate needs Second table for any type of mapping
PostPosted: Tue Aug 18, 2009 12:09 pm 
Beginner
Beginner

Joined: Tue Dec 21, 2004 11:53 am
Posts: 42
I've checked some apps we have in production and the mapping is working, but when running the jboss tools I still get this error.
anyone please?


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

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.