Hibernate left join 错误大家帮忙看看谢谢!

异常信息:

org.springframework.orm.hibernate3.HibernateQueryException: outer or full join must be followed by path expression [select pt.productid,pt.name,pt.price,pt.content,pt.createtime,pt.hitCount, a.filepath from com.enation.groupware.product.core.Product pt left join ProductAttachment pa where pt.productid = pa.productid.productid and pa.isDefault=1 ProductAttachment pa inner join Attachment a where pa.attachmentid att att.attachmentid = a.attachmentid and pt.deleteflag=0 order by p.createtime desc]; nested exception is org.hibernate.QueryException: outer or full join must be followed by path expression [select pt.productid,pt.name,pt.price,pt.content,pt.createtime,pt.hitCount, a.filepath from com.enation.groupware.product.core.Product pt left join ProductAttachment pa where pt.productid = pa.productid.productid and pa.isDefault=1 ProductAttachment pa inner join Attachment a where pa.attachmentid att att.attachmentid = a.attachmentid and pt.deleteflag=0 order by p.createtime desc]
Caused by: org.hibernate.QueryException: outer or full join must be followed by path expression [select pt.productid,pt.name,pt.price,pt.content,pt.createtime,pt.hitCount, a.filepath from com.enation.groupware.product.core.Product pt left join ProductAttachment pa where pt.productid = pa.productid.productid and pa.isDefault=1 ProductAttachment pa inner join Attachment a where pa.attachmentid att att.attachmentid = a.attachmentid and pt.deleteflag=0 order by p.createtime desc]
at org.hibernate.hql.classic.FromParser.token(FromParser.java:170)
at org.hibernate.hql.classic.ClauseParser.token(ClauseParser.java:86)
at org.hibernate.hql.classic.PreprocessingParser.token(PreprocessingParser.java:108)
at org.hibernate.hql.classic.ParserHelper.parse(ParserHelper.java:28)
at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:216)
at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:185)
at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.orm.hibernate3.HibernateTemplate$CloseSuppressingInvocationHandler.invoke(HibernateTemplate.java:1202)
at $Proxy2.createQuery(Unknown Source)
at com.enation.framework.dao.BaseDAO$1.doInHibernate(BaseDAO.java:40)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:338)
at com.enation.framework.dao.BaseDAO.getObjectsByPage(BaseDAO.java:36)
at com.enation.groupware.product.core.MysqlCmsProductDAO.getProductList(MysqlCmsProductDAO.java:90)
at com.enation.groupware.product.core.MysqlCmsProductDAO$$FastClassByCGLIB$$16d2a479.invoke()
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:694)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:629)
at com.enation.groupware.product.core.MysqlCmsProductDAO$$EnhancerByCGLIB$$c39d56b0.getProductList()
at com.enation.cms.test.TestDAOTest.testList(TestDAOTest.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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 org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)




HQL:
 
String hql = "";
hql += "select pt.productid,pt.name,pt.price,pt.content,pt.createtime,pt.hitCount, a.filepath " +
"from Product pt " +
"left join ProductAttachment pa where pt.productid = pa.productid.productid and pa.isDefault=1 ProductAttachment pa " + "inner join Attachment a where pa.attachmentid att att.attachmentid = a.attachmentid" + " and pt.deleteflag=0";




*.hbl


"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">





































class="com.enation.groupware.product.core.ProductAttachment" />



你可能感兴趣的:(JAVA)