From: Markus J. (JIRA) <no...@at...> - 2006-06-19 15:34:33
|
Polymorphic association to a MappedSuperclass throws exception -------------------------------------------------------------- Key: EJB-199 URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-199 Project: Hibernate Entity Manager Type: Bug Components: EntityManager Versions: 3.2.0.cr1 Environment: Annotations CR1, EntityManager CR1, and Hibernate 3.2 CR2 Reporter: Markus Junginger I think it should be possible to have polymorphic association to a class annotated as a MappedSuperclass. However, this combination throws an exception. The class Xyz is a super class for a couple of entity classes: @MappedSuperclass public abstract class Xyz{...} The following association to Xyz does not work (see exception below) @ManyToOne(fetch = FetchType.LAZY) @JoinColumns({...}) private Xyz test; If it matters, each entity (the sub classes of Xyz) is annotated with @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS). Here's the execption: javax.persistence.PersistenceException: org.hibernate.AnnotationException: @OneToOne or @ManyToOne on play.abc.test references an unknown entity: play.Xyz at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:196) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:114) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:27) ... Caused by: org.hibernate.AnnotationException: @OneToOne or @ManyToOne on play.abc.test references an unknown entity: play.Xyz at org.hibernate.cfg.FkSecondPass.doSecondPass(FkSecondPass.java:40) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:261) at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1034) at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:868) at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:163) at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:641) at org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configuration.java:134) at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:188) ... 20 more -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |