NutzCN Logo
问答 求教,为啥得不到实体对象啊
发布于 2503天前 作者 qq_2ac473ac 1462 次浏览 复制 上一个帖子 下一个帖子
标签:
	Criteria cnd = Cnd.cri();
	Sql sql = Sqls.create("SELECT b.* FROM ptoder AS b,manuscript AS a $condition");
	sql.setCallback(Sqls.callback.entities());
	sql.setPager(pager);
	if(!manuscriptname.equals("")&&manuscriptname!=null) {
		cnd.where().and("a.id", "=", "b.manuscriptid").and("a.state", "=", 0).and("a.Manuscriptname","=",manuscriptname);
	}
	if(state!=-2) {
		cnd.where().and("b.state", "=", state);
	}
	sql.setCondition(cnd);
	 dao.execute(sql);
	 List oder=sql.getList(PtOder.class);



18-01-08 18:19:11.816 DEBUG [http-bio-8080-exec-132] SELECT b.* FROM ptoder AS b,manuscript AS a  WHERE b.state=? LIMIT 0, 30
    | 1 |
    |---|
    | 0 |
  For example:> "SELECT b.* FROM ptoder AS b,manuscript AS a  WHERE b.state=0 LIMIT 0, 30"
18-01-08 18:19:11.839 WARN [http-bio-8080-exec-132] Error@/ptsys/loadOder :
org.nutz.dao.DaoException: java.lang.RuntimeException: SQL without entity : SELECT b.* FROM ptoder AS b,manuscript AS a  WHERE b.state=0 LIMIT 0, 30
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithoutTransaction(NutDaoRunner.java:139)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:92)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:81)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:240)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:252)
	at org.nutz.dao.impl.DaoSupport.execute(DaoSupport.java:236)
	at org.nutz.dao.impl.NutDao.execute(NutDao.java:1008)
	at com.qcjy.kotya.service.PartTimeService.getOderbyName(PartTimeService.java:106)
	at com.qcjy.kotya.module.PartTimeSysModule.loadOder(PartTimeSysModule.java:131)
	at com.qcjy.kotya.module.PartTimeSysModule$FM$loadOder$3ef125152b171de8a1c5459533cf3820.invoke(PartTimeSysModule.java)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:31)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.integration.shiro.NutShiroProcessor.process(NutShiroProcessor.java:126)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:202)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
6 回复

没调用sql.setEntity

这个打印出来的sql是

SELECT b.* FROM ptoder AS b,manuscript AS a  WHERE a.id='b.manuscriptid' AND a.state=0 AND a.Manuscriptname='123' AND b.state=0 LIMIT 0, 30
cnd.where().and("a.id", "=", "b.manuscriptid").and("a.state", "=", 0).and("a.Manuscriptname","=",manuscriptname);

这个情况应该怎么改啊?多了个单引号

and(new Static(".....")).and....

看了api ,还是没有弄懂sql.setEntity应该怎么用啊,参数应该给啥?

sql.setEntity(dao.getEntity(PtOder.class));用个这个,还是报错

可以了,加错地方了

添加回复
请先登陆
回到顶部