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
|