-->
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: I got "MappingException: collection was not an associat
PostPosted: Sat Apr 09, 2005 11:30 pm 
Newbie

Joined: Sat Apr 09, 2005 11:01 pm
Posts: 1
I use a collection of components for a many-to-many association, and Hibernate throws MappingException when I query it using criteria. The code is as following.
But Hibernate works correctly when I use HQL(from PatentApplyForm paf join paf.inventorDatas ids) to query!
And If I change the association to general many-to-many (without components) association, the criteria works fine!
The one I can't do is simply many-to-many with components using criteria query!

Hibernate version: 216

Mapping documents:
<class name="PatentApplyForm" table="...">
...
<set name="inventorDatas" table="...">
<key column="DCNO"/>
<composite-element class="InventorData">
<many-to-one name="inventorPersonal" class="InventorPersonal" column="INVER_ID" />
<property name="reqerYn" column="REQER_YN" />
</composite-element>
</set>
</class>

Code:
Criteria criteria = session.createCriteria(PatentApplyForm.class);
criteria.createAlias("inventorDatas", "ids"); // throw MappingException...

Full stack trace of exception:
net.sf.hibernate.MappingException: collection was not an association: tw.gov.nsc.rp.patent.PatentApplyForm.inventorDatas
at net.sf.hibernate.type.PersistentCollectionType.getAssociatedClass(PersistentCollectionType.java:206)
at net.sf.hibernate.impl.CriteriaImpl.getClassForPath(CriteriaImpl.java:345)
at net.sf.hibernate.impl.CriteriaImpl.createAlias(CriteriaImpl.java:302)
at net.sf.hibernate.impl.CriteriaImpl.createAlias(CriteriaImpl.java:276)
...


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.