NutzCN Logo
问答 Nutz dao的一个问题
发布于 2623天前 作者 Howe 1454 次浏览 复制 上一个帖子 下一个帖子
标签:

Pojo

@Column("is_show")
    private Integer isShow;

    public Integer getIsShow() {
        return isShow;
    }

    public void setIsShow(Integer isShow) {
        isShow = isShow;
    }

使用方法

List<Transportation> transportationList = dao().query(Transportation.class, Cnd.where("divisionId", "=",
                    reqParam.getDivisionId()).and("isShow", "=", "1").desc("storageTime"));

打印的error

org.nutz.dao.DaoException: !Nutz SQL Error: 'SELECT * FROM division_transportation  WHERE division_id=10001 AND isShow='1' ORDER BY storage_time DESC  '
PreparedStatement: 
'SELECT * FROM division_transportation  WHERE division_id=? AND isShow=? ORDER BY storage_time DESC  '
CaseMessage=Unknown column 'isShow' in 'where clause'
        at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:104) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:158) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:104) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:88) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.dao.impl.sql.run.NutDaoRunner$1.run(NutDaoRunner.java:74) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.trans.Trans.exec(Trans.java:174) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:72) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:245) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:257) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.dao.impl.NutDao.query(NutDao.java:439) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.dao.impl.NutDao.query(NutDao.java:444) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at com.cpsdna.module.DivisionModule.getTransportationList(DivisionModule.java:116) ~[classes/:?]
        at com.cpsdna.module.DivisionModule$$NUTZAOP._aop_invoke(DivisionModule.java:4) ~[nutz-1.r.62-SNAPSHOT.jar:?]
        at org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:77) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:57) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.aop.interceptor.TransactionInterceptor.filter(TransactionInterceptor.java:34) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at com.cpsdna.module.DivisionModule$$NUTZAOP.getTransportationList(DivisionModule.java:1) ~[nutz-1.r.62-SNAPSHOT.jar:?]
        at com.cpsdna.module.DivisionModule$FM$getTransportationList$b2ce138f07074c67765a239f28c893d4.invoke(DivisionModule.java) ~[nutz-1.r.62-SNAPSHOT.jar:?]
        at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:31) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44) [nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67) [nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31) [nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:202) [nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [catalina.jar:8.5.13]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [catalina.jar:8.5.13]
        at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71) [log4j-web-2.8.2.jar:2.8.2]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [catalina.jar:8.5.13]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [catalina.jar:8.5.13]
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) [catalina.jar:8.5.13]
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [catalina.jar:8.5.13]
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478) [catalina.jar:8.5.13]
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [catalina.jar:8.5.13]
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80) [catalina.jar:8.5.13]
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [catalina.jar:8.5.13]
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:341) [catalina.jar:8.5.13]
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799) [tomcat-coyote.jar:8.5.13]
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-coyote.jar:8.5.13]
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861) [tomcat-coyote.jar:8.5.13]
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455) [tomcat-coyote.jar:8.5.13]
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:8.5.13]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_121]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_121]
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.5.13]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'isShow' in 'where clause'
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_121]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_121]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_121]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_121]
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[mysql-connector-java-5.1.41.jar:5.1.41]
        at com.mysql.jdbc.Util.getInstance(Util.java:408) ~[mysql-connector-java-5.1.41.jar:5.1.41]
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:943) ~[mysql-connector-java-5.1.41.jar:5.1.41]
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973) ~[mysql-connector-java-5.1.41.jar:5.1.41]
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909) ~[mysql-connector-java-5.1.41.jar:5.1.41]
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527) ~[mysql-connector-java-5.1.41.jar:5.1.41]
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680) ~[mysql-connector-java-5.1.41.jar:5.1.41]
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2501) ~[mysql-connector-java-5.1.41.jar:5.1.41]
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858) ~[mysql-connector-java-5.1.41.jar:5.1.41]
        at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1966) ~[mysql-connector-java-5.1.41.jar:5.1.41]
        at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeQuery(FilterChainImpl.java:2714) ~[druid-1.0.29.jar:1.0.29]
        at com.alibaba.druid.filter.FilterAdapter.preparedStatement_executeQuery(FilterAdapter.java:1064) ~[druid-1.0.29.jar:1.0.29]
        at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeQuery(FilterChainImpl.java:2711) ~[druid-1.0.29.jar:1.0.29]
        at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.executeQuery(PreparedStatementProxyImpl.java:145) ~[druid-1.0.29.jar:1.0.29]
        at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeQuery(DruidPooledPreparedStatement.java:227) ~[druid-1.0.29.jar:1.0.29]
        at org.nutz.dao.impl.sql.run.NutDaoExecutor._runSelect(NutDaoExecutor.java:272) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:53) ~[nutz-1.r.62-SNAPSHOT.jar:1.r.62-SNAPSHOT]
        ... 58 more
^C
1 回复

java属性改成show试试

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