-->
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: SQLQuery and Collection Roles
PostPosted: Wed Jun 22, 2005 10:18 am 
Newbie

Joined: Wed Jun 22, 2005 10:07 am
Posts: 5
Hibernate version: 3.0.4


Full stack trace of any exception that occurs:
org.hibernate.HibernateException: Only one colection role return can be specified per sql-query
at org.hibernate.loader.custom.SQLQueryReturnProcessor.processRoleReturn(SQLQueryReturnProcessor.java:184)
at org.hibernate.loader.custom.SQLQueryReturnProcessor.processReturn(SQLQueryReturnProcessor.java:103)
at org.hibernate.loader.custom.SQLQueryReturnProcessor.process(SQLQueryReturnProcessor.java:86)
at org.hibernate.loader.custom.SQLCustomQuery.<init>(SQLCustomQuery.java:95)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:142)



Name and version of the database you are using: SQL Server 2000




I noticed there is a constraint on collections reached from a root entity in sql queries. I have entity A related to entities B and C as collections (a.bSet, a.cSet). I tried to construct an sqlQuery (because I needed a additional left join constraint but that's another thing) which selects A,B,C entities.

My query looks like

select {a.*},{b.*},{c.*}
from A as a
join B as b on b.Aid=a.id
left join C as c on C.Aid=a.id and c.type=2
where ....

and my query Object has been set as

query.addEntity("a",A.class).
addJoin("b","a.bSet")
addJoin("c","a.cSet");

That's when I got the exception.

Are there any known workarounds?

Thanks


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.