NutzCN Logo
问答 修改了实体类对应表的名称,但是调用insert()的时候SQL语句还是往之前的表里插入数据,导致异常
发布于 2536天前 作者 ganchaoyang 1771 次浏览 复制 上一个帖子 下一个帖子
标签:

修改了实体类对应表的名称,但是调用insert()的时候SQL语句还是往之前的表里插入数据,导致异常。但是使用查询语句的时候正常。
出现错误的代码

_insert(sys_perm)

错误的日志(已经修改表名为sys_perm):

java.sql.SQLSyntaxErrorException: Table 'iotadmin.sys_menu' doesn't exist
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:536) ~[mysql-connector-java-6.0.6.jar:6.0.6]
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:513) ~[mysql-connector-java-6.0.6.jar:6.0.6]
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:115) ~[mysql-connector-java-6.0.6.jar:6.0.6]
	at com.mysql.cj.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:1983) ~[mysql-connector-java-6.0.6.jar:6.0.6]
	at com.mysql.cj.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:1936) ~[mysql-connector-java-6.0.6.jar:6.0.6]
	at com.mysql.cj.jdbc.StatementImpl.executeQuery(StatementImpl.java:1422) ~[mysql-connector-java-6.0.6.jar:6.0.6]
	at com.alibaba.druid.filter.FilterChainImpl.statement_executeQuery(FilterChainImpl.java:2363) ~[druid-1.0.26.jar:1.0.26]
	at com.alibaba.druid.filter.FilterAdapter.statement_executeQuery(FilterAdapter.java:2481) ~[druid-1.0.26.jar:1.0.26]
	at com.alibaba.druid.filter.FilterEventAdapter.statement_executeQuery(FilterEventAdapter.java:302) ~[druid-1.0.26.jar:1.0.26]
	at com.alibaba.druid.filter.FilterChainImpl.statement_executeQuery(FilterChainImpl.java:2360) ~[druid-1.0.26.jar:1.0.26]
	at com.alibaba.druid.proxy.jdbc.StatementProxyImpl.executeQuery(StatementProxyImpl.java:211) ~[druid-1.0.26.jar:1.0.26]
	at com.alibaba.druid.pool.DruidPooledStatement.executeQuery(DruidPooledStatement.java:138) ~[druid-1.0.26.jar:1.0.26]
	at org.nutz.dao.impl.sql.run.NutDaoExecutor._runSelect(NutDaoExecutor.java:246) ~[nutz-1.r.62.jar:1.r.62]
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:53) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:158) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:104) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:88) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.dao.impl.sql.run.NutDaoRunner$1.run(NutDaoRunner.java:74) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.trans.Trans.exec(Trans.java:174) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:72) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:240) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:252) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.dao.impl.EntityOperator.exec(EntityOperator.java:55) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.dao.impl.NutDao.insert(NutDao.java:148) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.service.EntityService._insert(EntityService.java:351) [nutz-1.r.62.jar:1.r.62]
	at cn.xhbds.nutzkt.service.PermissionServiceImpl.add(PermissionService.kt:31) [classes/:?]
	at cn.xhbds.nutzkt.module.PermissionModule.addDo(PermissionModule.kt:101) [classes/:?]
	at cn.xhbds.nutzkt.module.PermissionModule$FM$addDo$eb149e1451b818a0b1972cd5c5234afd.invoke(PermissionModule.java) [nutz-1.r.62.jar:?]
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:31) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.integration.shiro.NutShiroProcessor.process(NutShiroProcessor.java:126) [nutz-integration-shiro-1.r.62.jar:?]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.62.jar:1.r.62]
	at cn.xhbds.nutzkt.mvc.LogTimeProcessor.process(LogTimeProcessor.kt:40) [classes/:?]
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31) [nutz-1.r.62.jar:1.r.62]
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:202) [nutz-1.r.62.jar:1.r.62]
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637) [jetty-servlet-9.4.8.v20171121.jar:9.4.8.v20171121]
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123) [druid-1.0.26.jar:1.0.26]
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637) [jetty-servlet-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) [shiro-web-1.3.2.jar:1.3.2]
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) [shiro-web-1.3.2.jar:1.3.2]
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) [shiro-web-1.3.2.jar:1.3.2]
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-web-1.3.2.jar:1.3.2]
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) [shiro-web-1.3.2.jar:1.3.2]
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) [shiro-web-1.3.2.jar:1.3.2]
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) [shiro-web-1.3.2.jar:1.3.2]
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) [shiro-core-1.2.3.jar:1.2.3]
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) [shiro-core-1.2.3.jar:1.2.3]
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) [shiro-core-1.2.3.jar:1.2.3]
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) [shiro-web-1.3.2.jar:1.3.2]
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-web-1.3.2.jar:1.3.2]
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1629) [jetty-servlet-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71) [log4j-web-2.6.jar:2.6]
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637) [jetty-servlet-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533) [jetty-servlet-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) [jetty-security-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473) [jetty-servlet-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:219) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.server.Server.handle(Server.java:530) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279) [jetty-io-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102) [jetty-io-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124) [jetty-io-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247) [jetty-util-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140) [jetty-util-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) [jetty-util-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382) [jetty-util-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708) [jetty-util-9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626) [jetty-util-9.4.8.v20171121.jar:9.4.8.v20171121]
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_112]
12:01:36.062 ERROR (PermissionModule.kt:104) addDo - !Nutz SQL Error: 'SELECT IFNULL(MAX(location),0)+1 FROM sys_menu'
6 回复

@Prev没改吧

实体类么?我这边只有id字段上有Prev,需要改成啥呢?

@Table("sys_perm")
@TableIndexes(Index(name = "INDEX_SYS_PERM_PATH", fields = ["path"], unique = true),
    Index(name = "INDEX_SYS_PERM_PREM", fields = ["permission"], unique = true))
class Sys_perm : BasePojo(), Serializable {
    @Column
    @Name
    @Comment("ID")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    @Prev(els = arrayOf(EL("uuid()")))
    var id: String? = null

BasePojo 里面吧

这个里面好像也没有看到


abstract class BasePojo { // 创建时间 @Prev(els=[EL("\$me.now()")]) @Column("ct") @Comment("创建时间") var createTime:Date? = null // 修改时间 @Prev(els=[EL("\$me.now()")]) @Column("ut") @Comment("修改时间") var updateTime:Date? = null @Column @Comment("操作人") @Prev(els=arrayOf(EL("\$me.uid()"))) @ColDefine(type= ColType.VARCHAR, width = 32) var opBy:String?=null @Column @Comment("操作时间") @Prev(els=[EL("\$me.intNow()")]) @ColDefine(type = ColType.INT) var opAt:Int=0 @Column @Comment("删除标记") @Prev(els=[EL("\$me.flag()")]) @ColDefine(type= ColType.BOOLEAN) var delFalg:Boolean=false

那就全局搜IFNULL(MAX(

找到了,谢谢

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