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.