-->
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.  [ 2 posts ] 
Author Message
 Post subject: pls help me HQL problem
PostPosted: Thu Apr 01, 2004 4:21 am 
Newbie

Joined: Sun Nov 30, 2003 10:09 am
Posts: 14
Hello all,
Here is my sql.
A user can have many roles.

<hibernate-mapping>
<class name="com.mislbd.iris.marketing.survey.UserDTO" table="TestUser">
<id column="userId" name="id">
<generator class="increment"/>
</id>
<property name="name"/>
<property name="loginId"/>
<property name="password"/>
<list name="roles" table="TestUserRoles" cascade="all">
<key column="userId"/>
<index column="lineItemIndex"/>
<composite-element class="com.mislbd.iris.marketing.survey.UserRoles">
<property name="roleName"/>
<property name="roleId"/>
<property name="weight"/>
<property name="description"/>
</composite-element>
</list>
</class>
</hibernate-mapping>


If want to execute the HQL
select a.name,b.roleName,b.description
from UserDTO a inner join a.roles
order by b.roleName

I got the follwing exception



Exception in thread "main" net.sf.hibernate.QueryException: collection of values in from clause: userdto0_.roles.elements [select a.name,b.roleName,b.description from com.mislbd.iris.marketing.survey.UserDTO a inner join a.roles order by b.roleName]
at net.sf.hibernate.hql.PathExpressionParser.addFromCollection(PathExpressionParser.java:420)
at net.sf.hibernate.hql.FromParser.token(FromParser.java:195)
at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
at net.sf.hibernate.hql.PreprocessingParser.token(PreprocessingParser.java:120)
at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:29)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:146)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:133)
at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:352)
at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:330)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1368)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1332)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1322)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1314)
at com.mislbd.iris.marketing.survey.UserMain.main(UserMain.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
Process terminated with exit code 1


pls give me a solution
Regards
Banik


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 01, 2004 4:25 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Use the 2.1 version of Hibernate

_________________
Emmanuel


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