List listinfo = sql.getList(TopSpecialColumnTxtItemInfo.class);
我想查询通过这个实体类创建的view 改怎么查??? 想用 dao.count() 查询视图中的内容 怎么查???
Sql sql = Sqls.create("SELECT count(*) FROM `t_special_column_txt_item_info` "
+ "where (id not in (select t_special_column_txt_item_info_id from"
+ " `t_ee_special_column_txt_item_info` WHERE state=1 ) AND column_id=85) "
+ "OR (id not in (select t_special_column_txt_item_info_id from "
+ "`t_ee_special_column_txt_item_info` WHERE state=1 ) AND column_id=25)"
+ " ORDER BY add_time DESC");
sql.setCallback(Sqls.callback.entities());
sql.setEntity(dao.getEntity(Integer.class));
dao.execute(sql);
int allcount = sql.getInt();
Need non-arg constructor : int
at org.nutz.dao.impl.entity.NutEntity.<init>(NutEntity.java:211)
at org.nutz.dao.impl.entity.AnnotationEntityMaker._createNutEntity(AnnotationEntityMaker.java:558)
at org.nutz.dao.impl.entity.AnnotationEntityMaker.make(AnnotationEntityMaker.java:89)
at org.nutz.dao.impl.EntityHolder.getEntity(EntityHolder.java:69)
at org.nutz.dao.impl.NutDao.getEntity(NutDao.java:646)
at com.bluefrog.wx.module.JJLDEEModule.allpage(JJLDEEModule.java:1225)
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.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:25)
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:40)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:119)
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:179)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java
这个 为啥会报错呢????
那我这个 如何获取返回的int值呢??? 改成intteger也不对 因为我想获得连表查询的数据总量,如果单纯的从 t_special_column_txt_item_info 表中查数据量会不对, 昨天想了很久还是不知道如何获取
Sql sql = Sqls.fetchInt("SELECT count(*) FROM `t_special_column_txt_item_info` "
+ "where (id not in (select t_special_column_txt_item_info_id from"
+ " `t_ee_special_column_txt_item_info` WHERE state=1 ) AND column_id=85) "
+ "OR (id not in (select t_special_column_txt_item_info_id from "
+ "`t_ee_special_column_txt_item_info` WHERE state=1 ) AND column_id=25)"
+ " ORDER BY add_time DESC");
dao.execute(sql);
int allcount = sql.getInt();
Sql sql = Sqls.create("SELECT count(*) FROM `t_special_column_txt_item_info` "
+ "where (id not in (select t_special_column_txt_item_info_id from"
+ " `t_ee_special_column_txt_item_info` WHERE state=1 ) AND column_id=85) "
+ "OR (id not in (select t_special_column_txt_item_info_id from "
+ "`t_ee_special_column_txt_item_info` WHERE state=1 ) AND column_id=25)"
+ " ORDER BY add_time DESC");
dao.execute(sql);
int allcount = sql.getInt();
java.lang.NullPointerException
at org.nutz.dao.impl.sql.NutStatement.getInt(NutStatement.java:121)
at com.bluefrog.wx.module.JJLDEEModule.allpage(JJLDEEModule.java:1225)
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.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:25)
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:40)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:119)
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:179)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina
还是报的那个.....
有数据 这个sql语句在mysql中执行的又407条数据呢