我现在的项目用的是Tapestry3.0+Spring+Hibernate2.0+orcale9i,DEBUG是我生成的SQL语句,我发现我的SQL是后面(to_char(e.fareNumber) || to_char(e.approvedDate,'yyyy-mm-dd hh24:mi:ss')) in ( select to_char(f.fareNumber) || to_char(f.approvedDate,'yyyy-mm-dd hh24:mi:ss') from Fare f where 1=1 and f.batchId = :batchId) 这里错了,各位,是不是Hibernate hsql 里的 in 不支持select query:我它改为(to_char(e.fareNumber) || to_char(e.approvedDate,'yyyy-mm-dd hh24:mi:ss')) in ('','')就可以了:经过测试,发现这句select to_char(f.fareNumber) || to_char(f.approvedDate,'yyyy-mm-dd hh24:mi:ss') from Fare f where 1=1 and f.batchId = :batchId不对好像不支持上面红色字体的,但是我想实现...该如何实现
指点迷津,谢谢,下面是错误信息:
DEBUG (FaresManagement.java:249) - 生成的SQL语句是:select e.uuid,e.batchId,e.fareNumber,e.groupId,e.comType,e.effDate,e.endDate,e.approvedDate,e.baseComm,e.baseType from GroupFare e where e.endDate is null and e.batchId = :batchId and e.groupId = :groupId and (to_char(e.fareNumber) || to_char(e.approvedDate,'yyyy-mm-dd hh24:mi:ss')) in ( select to_char(f.fareNumber) || to_char(f.approvedDate,'yyyy-mm-dd hh24:mi:ss') from Fare f where 1=1 and f.batchId = :batchId)
org.springframework.orm.hibernate.HibernateQueryException: , expected in SELECT [select count(*) from com.footmarktech.domain.groups.GroupFare e where e.endDate is null and e.batchId = :batchId and e.groupId = :groupId and (to_char(e.fareNumber) || to_char(e.approvedDate,'yyyy-mm-dd hh24:mi:ss')) in ( select to_char(f.fareNumber) || to_char(f.approvedDate,'yyyy-mm-dd hh24:mi:ss') from com.footmarktech.domain.groups.Fare f where 1=1 and f.batchId = :batchId)]; nested exception is net.sf.hibernate.QueryException: , expected in SELECT [select count(*) from com.footmarktech.domain.groups.GroupFare e where e.endDate is null and e.batchId = :batchId and e.groupId = :groupId and (to_char(e.fareNumber) || to_char(e.approvedDate,'yyyy-mm-dd hh24:mi:ss')) in ( select to_char(f.fareNumber) || to_char(f.approvedDate,'yyyy-mm-dd hh24:mi:ss') from com.footmarktech.domain.groups.Fare f where 1=1 and f.batchId = :batchId)]
net.sf.hibernate.QueryException: , expected in SELECT [select count(*) from com.footmarktech.domain.groups.GroupFare e where e.endDate is null and e.batchId = :batchId and e.groupId = :groupId and (to_char(e.fareNumber) || to_char(e.approvedDate,'yyyy-mm-dd hh24:mi:ss')) in ( select to_char(f.fareNumber) || to_char(f.approvedDate,'yyyy-mm-dd hh24:mi:ss') from com.footmarktech.domain.groups.Fare f where 1=1 and f.batchId = :batchId)]
at net.sf.hibernate.hql.SelectParser.token(SelectParser.java:169)
at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
at net.sf.hibernate.hql.ClauseParser.end(ClauseParser.java:114)
at net.sf.hibernate.hql.PreprocessingParser.end(PreprocessingParser.java:143)
at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:30)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:149)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:124)
at net.sf.hibernate.hql.WhereParser.token(WhereParser.java:220)
at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
at net.sf.hibernate.hql.PreprocessingParser.end(PreprocessingParser.java:142)
at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:30)
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:295)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1572)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1543)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:49)
at com.footmarktech.persistence.hibernate.BaseDAOHibernate$3.doInHibernate(BaseDAOHibernate.java:164)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:312)
at org.springframework.orm.hibernate.HibernateTemplate.executeFind(HibernateTemplate.java:293)
at com.footmarktech.persistence.hibernate.BaseDAOHibernate.find(BaseDAOHibernate.java:139)
at common.tapestry.jwc.BaseDaoTableModel.getRowCount(BaseDaoTableModel.java:100)
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 ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:491)
at ognl.OgnlRuntime.getMethodValue(OgnlRuntime.java:904)
at ognl.ObjectPropertyAccessor.getPossibleProperty(ObjectPropertyAccessor.java:54)
at ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:122)
at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1616)
at ognl.ASTProperty.getValueBody(ASTProperty.java:96)
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
at ognl.SimpleNode.getValue(SimpleNode.java:210)
at ognl.ASTChain.getValueBody(ASTChain.java:109)
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
at ognl.SimpleNode.getValue(SimpleNode.java:210)
at ognl.ASTNotEq.getValueBody(ASTNotEq.java:49)
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
at ognl.SimpleNode.getValue(SimpleNode.java:210)
at ognl.Ognl.getValue(Ognl.java:333)
at ognl.Ognl.getValue(Ognl.java:310)
at org.apache.tapestry.binding.ExpressionBinding.resolveProperty(ExpressionBinding.java:201)
at org.apache.tapestry.binding.ExpressionBinding.getObject(ExpressionBinding.java:194)
at org.apache.tapestry.binding.AbstractBinding.getBoolean(AbstractBinding.java:77)
at org.apache.tapestry.param.BooleanParameterConnector.setParameter(BooleanParameterConnector.java:51)
at org.apache.tapestry.param.ParameterManager.setParameters(ParameterManager.java:105)
at org.apache.tapestry.AbstractComponent.prepareForRender(AbstractComponent.java:898)
at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:853)
at org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:624)
at org.apache.tapestry.components.RenderBody.renderComponent(RenderBody.java:45)
at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)
at org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:624)
at org.apache.tapestry.html.Body.renderComponent(Body.java:269)
at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)
at org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:624)
at org.apache.tapestry.html.Shell.renderComponent(Shell.java:124)
at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)
at org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:118)
at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)
at org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:118)
at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)
at org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:300)
at org.apache.tapestry.engine.RequestCycle.renderPage(RequestCycle.java:368)
at org.apache.tapestry.engine.AbstractEngine.renderResponse(AbstractEngine.java:749)
at com.footmarktech.web.FootmarkEngine.renderResponse(FootmarkEngine.java:413)
at org.apache.tapestry.engine.DirectService.service(DirectService.java:174)
at org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:889)
at org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:198)
at org.apache.tapestry.ApplicationServlet.doPost(ApplicationServlet.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at org.apache.tapestry.RedirectFilter.doFilter(RedirectFilter.java:106)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6458)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)