Hi,
This may be a bug or a limitation of HSQL that I haven't read about yet.
I'll try to explain so that you can reproduce this without seeing my code.
I have a class A, that has a one-to-many realtionship to class B. Class B has a many-to-one to class C.
This HSQL works as expected
[code]from A as a
join fetch a.bSet as setOfB
join fetch setOfB.c
where a.typeId = :typeId[/code]
However when I execute this HSQL I get an exception, [b]why does the alias make a difference?[/b]
[code]from A as a
join fetch a.bSet
join fetch a.bSet.c
where a.typeId = :typeId[/code]
net.sf.hibernate.QueryException: expecting 'elements' or 'indices' after: c
[
from A as a
join fetch a.bSet
join fetch a.bSet.c
where a.typeId = :typeId
]
at net.sf.hibernate.collection.CollectionPropertyMapping.toType(CollectionPropertyMapping.java:53)
at net.sf.hibernate.hql.PathExpressionParser.getPropertyType(PathExpressionParser.java:244)
at net.sf.hibernate.hql.PathExpressionParser.isCollectionValued(PathExpressionParser.java:401)
at net.sf.hibernate.hql.FromPathExpressionParser.end(FromPathExpressionParser.java:11)
at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:30)
at net.sf.hibernate.hql.FromParser.token(FromParser.java:193)
at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
at net.sf.hibernate.hql.PreprocessingParser.token(PreprocessingParser.java:123)
at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:29)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:149)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:138)
at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:293)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1530)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1501)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at milestonegroup.pcontrol.server.service.system.file.FileVersionService.getAllFilesByType(FileVersionService.java:151)
at milestonegroup.pcontrol.server.service.system.file.FileVersionServiceTest.getFilesByType(FileVersionServiceTest.java:198)
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 junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.swingui.TestRunner$16.run(TestRunner.java:623)
|