[hibernate-issues] [Hibernate-JIRA] Moved: (ANN-427) throw "java.lang.IllegalStateException: Property parent has an unbound type and no explicit target entity." on generic type
Emmanuel Bernard (JIRA)
noreply at atlassian.com
Mon Aug 28 18:47:25 EDT 2006
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-427?page=all ]
Emmanuel Bernard moved EJB-213 to ANN-427:
------------------------------------------
Project: Hibernate Annotations (was: Hibernate Entity Manager)
Key: ANN-427 (was: EJB-213)
Component: binder
(was: EntityManager)
Version: 3.2.0.cr1
(was: 3.2.0.cr1)
> throw "java.lang.IllegalStateException: Property parent has an unbound type and no explicit target entity." on generic type
> ---------------------------------------------------------------------------------------------------------------------------
>
> Key: ANN-427
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-427
> Project: Hibernate Annotations
> Type: Bug
> Components: binder
> Versions: 3.2.0.cr1
> Environment: Hibernate version: 3.2.0.cr2<br>
> Mapping documents: Annotations 3.2.0.cr1
> Reporter: Zheng.Duan
> Attachments: jira.zip
>
> Original Estimate: 2 weeks
> Remaining: 2 weeks
>
> Classes and mapping code: <br>
> <code>
> @MappedSuperclass
> public abstract class Child<P extends Parent> {
> @Id Long id;
> @ManyToOne P parent;
> ...
> }
> @MappedSuperclass
> public abstract class Parent<C extends Child> {
> @Id @GeneratedValue Long id;
> @MapKey @OneToMany(mappedBy="parent") Map<Long,C> children = new HashMap<Long,C>();
> ...
> }
> @Entity
> public class ChildHierarchy1 extends Child<ParentHierarchy1> {
> ....
> }
> @Entity
> public class ParentHierarchy1 extends Parent<ChildHierarchy1> {
> ....
> }
> @MappedSuperclass
> public class ChildHierarchy2<P extends ParentHierarchy2> extends Child<P> {
> ....
> }
> @MappedSuperclass
> public class ParentHierarchy2<C extends ChildHierarchy2> extends Parent<C> {
> ....
> }
> @Entity
> public class ChildHierarchy22 extends ChildHierarchy2<ParentHierarchy22> {
> ....
> }
> @Entity
> public class ParentHierarchy22 extends ParentHierarchy2<ChildHierarchy22> {
> ....
> }
> </code>
> Full stack trace of exception:
> <code>
> Caused by: java.lang.IllegalStateException: Property parent has an unbound type and no explicit target entity.
> at org.hibernate.cfg.AnnotationBinder.addElementsOfAClass(AnnotationBinder.java:938)
> at org.hibernate.cfg.AnnotationBinder.getElementsToProcess(AnnotationBinder.java:788)
> at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:615)
> at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:353)
> at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:265)
> at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1034)
> at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1015)
> at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
> at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:751)
> at org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configuration.java:151)
> at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:205)
> ... 4 more
> </code>
> if let <code>org.hibernate.cfg.AnnotationBinder.hasExplicitTargetEntity(XProperty p)</code> return <code>true</code>(it return <code>false</code> actually) then throw:<br>
> <code>
> Caused by: org.hibernate.AnnotationException: @OneToOne or @ManyToOne on zhengduan.entities.ChildHierarchy22.parent references an unknown entity: zhengduan.entities.ParentHierarchy2
> at org.hibernate.cfg.FkSecondPass.doSecondPass(FkSecondPass.java:40)
> at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:288)
> at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1034)
> at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1015)
> at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
> at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:751)
> at org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configuration.java:151)
> at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:205)
> ... 4 more
> </code>
> But it's wrong, <code>zhengduan.entities.ChildHierarchy22.parent</code> references <code>zhengduan.entities.ParentHierarchy22</code>, not <code>zhengduan.entities.ParentHierarchy2</code>!
--
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
More information about the hibernate-issues
mailing list