NutzCN Logo
问答 我想得到执行SQL语句对应的SysUserRole对象信息
发布于 2719天前 作者 nutzJ 2125 次浏览 复制 上一个帖子 下一个帖子
标签:

我想得到执行这段SQL语句的结果,报错了,请问错哪了

	public SysUserRole getRoleInThemeType(String userId, String themeType){
		
		String sqlStr = "SELECT * FROM SYS_USER_ROLE WHERE ROLE_ID IN (SELECT J_ID FROM SYS_JSGL_QXGL WHERE Q_ID IN (SELECT QX_ID FROM SYS_QXGL WHERE URL IN ('dc/jsp/dcCheckFormula_m.jsp?themeType=" + themeType + "', 'dc/jsp/dcCheckAll.jsp?themeType=" + themeType + "')) AND USER_ID = '" + userId + "')";
		Sql sql = Sqls.create(sqlStr);
		sql.setCallback(new SqlCallback() {
			@Override
			public Object invoke(Connection conn, ResultSet resultSet, Sql sql)
					throws SQLException {
				SysUserRole sysUsrRole = new SysUserRole();
				while(resultSet.next()){
					sysUsrRole.setUserId(resultSet.getString("USER_ID"));
					sysUsrRole.setRoleId(resultSet.getString("ROLE_ID"));
				}
				return sysUsrRole;
			}
		});
		dao().execute(sql);
		return sql.getObject(SysUserRole.class);
	}

错误信息

java.util.FormatFlagsConversionMismatchException: Conversion = b, Flags =  
	at java.util.Formatter$FormatSpecifier.failMismatch(Formatter.java:4298) ~[na:1.8.0_112]
	at java.util.Formatter$FormatSpecifier.checkBadFlags(Formatter.java:2997) ~[na:1.8.0_112]
	at java.util.Formatter$FormatSpecifier.checkGeneral(Formatter.java:2955) ~[na:1.8.0_112]
	at java.util.Formatter$FormatSpecifier.<init>(Formatter.java:2725) ~[na:1.8.0_112]
	at java.util.Formatter.parse(Formatter.java:2560) ~[na:1.8.0_112]
	at java.util.Formatter.format(Formatter.java:2501) ~[na:1.8.0_112]
	at java.util.Formatter.format(Formatter.java:2455) ~[na:1.8.0_112]
	at java.lang.String.format(String.java:2940) ~[na:1.8.0_112]
	at org.nutz.log.impl.AbstractLog.makeInfo(AbstractLog.java:59) [nutz-1.b.53.jar:na]
	at org.nutz.log.impl.AbstractLog.debugf(AbstractLog.java:79) [nutz-1.b.53.jar:na]
	at org.nutz.dao.impl.entity.NutEntity.<init>(NutEntity.java:201) [nutz-1.b.53.jar:na]
	at org.nutz.dao.impl.entity.AnnotationEntityMaker._createNutEntity(AnnotationEntityMaker.java:551) [nutz-1.b.53.jar:na]
	at org.nutz.dao.impl.entity.AnnotationEntityMaker.make(AnnotationEntityMaker.java:89) [nutz-1.b.53.jar:na]
	at org.nutz.dao.impl.EntityHolder.getEntity(EntityHolder.java:65) [nutz-1.b.53.jar:na]
	at org.nutz.dao.impl.EntityHolder.getEntityBy(EntityHolder.java:180) [nutz-1.b.53.jar:na]
	at org.nutz.dao.impl.NutDao._optBy(NutDao.java:919) [nutz-1.b.53.jar:na]
	at org.nutz.dao.impl.NutDao.delete(NutDao.java:393) [nutz-1.b.53.jar:na]
	at com.efraiser.dc.dao.DcPermissionDao.deleteTableQx(DcPermissionDao.java:390) [classes/:na]
	at com.efraiser.dc.action.DcPermissionAction.deleteTableQx(DcPermissionAction.java:382) [classes/:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_112]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_112]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_112]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112]
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:25) [nutz-1.b.53.jar:na]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.b.53.jar:na]
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33) [nutz-1.b.53.jar:na]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.b.53.jar:na]
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:40) [nutz-1.b.53.jar:na]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.b.53.jar:na]
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:113) [nutz-1.b.53.jar:na]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.b.53.jar:na]
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27) [nutz-1.b.53.jar:na]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.b.53.jar:na]
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15) [nutz-1.b.53.jar:na]
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:40) [nutz-1.b.53.jar:na]
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67) [nutz-1.b.53.jar:na]
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31) [nutz-1.b.53.jar:na]
	at org.nutz.mvc.NutServlet.service(NutServlet.java:66) [nutz-1.b.53.jar:na]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) [servlet-api.jar:na]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) [catalina.jar:7.0.68]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.68]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat7-websocket.jar:7.0.68]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.68]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.68]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) [catalina.jar:7.0.68]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) [catalina.jar:7.0.68]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) [catalina.jar:7.0.68]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) [catalina.jar:7.0.68]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) [catalina.jar:7.0.68]
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956) [catalina.jar:7.0.68]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) [catalina.jar:7.0.68]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436) [catalina.jar:7.0.68]
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) [tomcat-coyote.jar:7.0.68]
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625) [tomcat-coyote.jar:7.0.68]
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318) [tomcat-coyote.jar:7.0.68]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_112]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_112]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-coyote.jar:7.0.68]
	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_112]
11:07:37 [DEBUG] org.nutz.dao.impl.entity.NutEntity - !!!!Log Fail!!
11:07:37 [WARN ] org.nutz.dao.impl.entity.AnnotationEntityMaker - No @Table found, fallback to use table name='cnd' for type 'org.nutz.dao.Cnd'
11:07:37 [DEBUG] org.nutz.dao.jdbc.Jdbcs - take field 'cri(org.nutz.dao.util.cri.SimpleCriteria)'(org.nutz.dao.Cnd) as VARCHAR(50)
11:07:37 [DEBUG] org.nutz.dao.impl.jdbc.AbstractJdbcExpert - Table 'cnd' doesn't exist!
4 回复

打个日志看resultSet.getString("USER_ID")和resultSet.getString("ROLE_ID")是不是有null的情况,

这是什么问题?除了这个方法,还有别的解决办法吗?我没权限换版本

那就找有权限的人去换.

另外报错的是dao.deletex,根本不是你贴的那堆代码里面

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