-->
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: @ManyToOne AnnotationException -references an unknown entity
PostPosted: Sat Aug 14, 2010 9:43 am 
Newbie

Joined: Sat Aug 14, 2010 9:35 am
Posts: 1
I am getting the following Exception and I don't understand what I am doing wrong or how to fix it.
It seems like it is an Inheritence issue. At runtime the code will be able to tell which instance of A (if it is B or something else), but it won't even get past startup.

Caused by: org.hibernate.AnnotationException: @OneToOne or @ManyToOne on ObjectC.a references an unknown entity: ObjectA

Code:
@MappedSuperclass
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class ObjectA {
}


Code:
@Entity
@Table(name = "B")
@Proxy(lazy = false)
public class ObjectB extends ObjectA {
}


Code:
@Entity
@Table(name = "TRANSACTION_BUYSELL")
@Proxy(lazy = false)
public class ObjectC {
   @ManyToOne
   @JoinColumn(nullable = false)
   ObjectA a = null;
}


From applicationContext.xml
Code:
<bean id="portfolioSessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
      <property name="dataSource" ref="portfolioDataSource" />
      <property name="annotatedClasses">
         <list>
            <value>ObjectA</value>
            <value>ObjectB</value>
            <value>ObjectC</value>
         </list>
      </property>
   </bean>


If I change the @Inheritance to be SINGLE_TABLE, it works fine, but I don't want a single table I want all subclasses of ObjectA to be in their own table.

Any help would be greatly appreciated.


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.