JPA自动封装实体

2009-9-4 8:46:13 com.sun.faces.lifecycle.LifecycleImpl phase
WARNING: phase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@31e2ad) threw exception: javax.faces.el.EvaluationException: org.hibernate.hql.ast.QuerySyntaxException: Unable to locate appropriate constructor on class [com.dz.web.ajaxbean.TransferOrderForTable] [select new com.dz.web.ajaxbean.TransferOrderForTable( oi.id, oi.customer.phone,oi.customer.custName,oi.customer.male,oi.customer.road,oi.customer.lane,oi.customer.branch,oi.customer.roadNo,oi.customer.building,oi.customer.doorNo,oi.customer.pickupPlace,oi.customer.destn, oi.expectedTime,oi.customer.remarks,oi.carCompany) from com.dz.dispatch.domain.Order oi LEFT JOIN  oi.customer where oi.expectedTime>=:expectedTime and oi.orderStatus=:orderStatus and oi.carCompany in (0,1,3,4,10,11,2) order by oi.carCompany, oi.id ] org.hibernate.hql.ast.QuerySyntaxException: Unable to locate appropriate constructor on class [com.dz.web.ajaxbean.TransferOrderForTable] [select new com.dz.web.ajaxbean.TransferOrderForTable( oi.id, oi.customer.phone,oi.customer.custName,oi.customer.male,oi.customer.road,oi.customer.lane,oi.customer.branch,oi.customer.roadNo,oi.customer.building,oi.customer.doorNo,oi.customer.pickupPlace,oi.customer.destn, oi.expectedTime,oi.customer.remarks,oi.carCompany) from com.dz.dispatch.domain.Order oi LEFT JOIN  oi.customer where oi.expectedTime>=:expectedTime and oi.orderStatus=:orderStatus and oi.carCompany in (0,1,3,4,10,11,2) order by oi.carCompany, oi.id ]
com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:97)
org.offseam.application.OnLoadPhaseListener.processRule(OnLoadPhaseListener.java:311)
org.offseam.application.OnLoadPhaseListener.processOnLoad(OnLoadPhaseListener.java:265)
org.offseam.application.OnLoadPhaseListener.beforePhase(OnLoadPhaseListener.java:131)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:301)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.offseam.Filter.doFilter(Filter.java:166)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
com.dz.web.filter.ValidateFiler.doFilter(ValidateFiler.java:56)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Thread.java:595)

以上为使用EntityManager.createQuery 自动封装至自定义EntityBean时,select出来的数据类型与EntityBean的构造方式中的不符,如
select new com.dz.web.ajaxbean.TransferOrderForTable( oi.id, oi.customer.phone,oi.customer.custName,oi.customer.male,oi.customer.road,oi.customer.lane,oi.customer.branch,oi.customer.roadNo,oi.customer.building,oi.customer.doorNo,oi.customer.pickupPlace,oi.customer.destn, oi.expectedTime,oi.customer.remarks,oi.carCompany) from ....


TransferOrderForTable(long id, String PHONE, String CUSTNAME,
            boolean MALE, String ROAD, String LANE, String BRANCH,
            String ROADNO, String BUILDING, String DOORNO, String PICKUPPLACE,
            String DESTN, Date EXPECTEDTIME, String REMARKS, long CARCOMPANY_id);

JPQL出的整型数据默认为Integer ,与long CARCOMPANY_id不符....

而使用EntityManager.creat额NativeQuery(sql,class)时,直接报sql语句未结束,此sql与createQuery中相同,怀疑是hib的bug

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值