-->
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.  [ 5 posts ] 
Author Message
 Post subject: Polymorphic association to a MappedSuperclass
PostPosted: Sun Jun 04, 2006 4:39 pm 
Newbie

Joined: Sun Jun 04, 2006 4:19 pm
Posts: 9
Location: Germany
Hi guys,

I am using Annotations CR1, EntityManager CR1, and Hibernate 3.2 CR2 and ran into some troubles with polymorphic associations..

I have the following class Xyz, which 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;

Each entity is annotated with
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS).

I am look forward to any help! Thank you!


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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 26, 2006 11:31 pm 
Newbie

Joined: Tue Mar 22, 2005 6:01 pm
Posts: 13
Location: Sydney, Australia
I'm having the same problem with this...

Does anybody have a clue with this one? Is this actually supposed to work in hibernate??

Cheers
J


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 04, 2006 4:51 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
associations only work between @Entity classes

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 22, 2006 3:22 pm 
Newbie

Joined: Wed Dec 06, 2006 5:27 pm
Posts: 3
Location: Argentina(Cordoba)
so, exists any type of annotations, configuration or , anything that allow an association between an @Entity and hbm.xml mapped class????

Thanks and Merry Xmas!!!!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 25, 2006 4:33 am 
Newbie

Joined: Fri Feb 24, 2006 8:26 pm
Posts: 5
I had a similar problem and found that I could use table per class inheritance in place of @MappedSuperclass. The only disadvantage I've run into is that using table per class doesn't allow overrides.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.