NutzCN Logo
精华 mysql@Name并不唯一问题
发布于 2935天前 作者 老司机 2664 次浏览 复制 上一个帖子 下一个帖子
标签:

@Id和@Name同时使用时@Name并不唯一,首先是bean

@Table("t_user")
public class User {
	@Id
	int id;
	@Name
	String username;
	@Column
	@ColDefine(width = 200)
	String password;
	@Column
	String salt;

debug

CREATE TABLE t_user(
id INT(32) AUTO_INCREMENT,
username VARCHAR(50) UNIQUE NOT NULL,
password VARCHAR(200),
salt VARCHAR(50),
PRIMARY KEY (id)
) ENGINE=InnoDB CHARSET=utf8

因为没法截图,就粘下导出的sql脚本

INSERT INTO `t_user` (`id`, `username`, `password`, `salt`) VALUES (1, 'xx', NULL, NULL);
INSERT INTO `t_user` (`id`, `username`, `password`, `salt`) VALUES (2, 'xx', NULL, NULL);

可以看到username是重复的?why?

20 回复

既然id是自增的,为啥insert语句里会有id呢?

@wendal sql不是我写的,是我用navicat导出的sql,实际表数据

"id"	"username"	"password"	"salt"
"1"	"xx"	""	""
"2"	"xx"	""	""

我没用sql,直接用navicat图形化界面往里面加数据,重点是为啥能重复啊

@qq_c1bab051 我觉得是连错数据库

@wendal ??这个debug并没有报错,而且nutz对数据的操作都可以正确执行,增删改查都没问题

那应该试试dao.insert重复的name

@wendal 我昨天就这么写的,然后插进去了……

@qq_c1bab051 所以叫你贴sql和日志

@wendal

2016-11-09 11:00:23,680 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) DEBUG - Found mapping for [POST] path=/user/register : UserModule.register(UserModule.java:26)
2016-11-09 11:00:23,680 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'userModule'<class weekly.modules.UserModule>
2016-11-09 11:00:23,683 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - INSERT INTO t_user(username,password,salt) VALUES(?,?,?) 
    |    1 |                                                                                                                                2 |                      3 |
    |------|----------------------------------------------------------------------------------------------------------------------------------|------------------------|
    | 岛田半藏 | fafce2bc3b948edae00cd1c34ac65bf5f7df13fad78757ee95dee25643dea1492fc27af43d79eb5937cefc278e99d74c007881df07eaba55f5a272044e477fde | awNJWhjMGhXaNvWAOEFKH- |
  For example:> "INSERT INTO t_user(username,password,salt) VALUES('岛田半藏','fafce2bc3b948edae00cd1c34ac65bf5f7df13fad78757ee95dee25643dea1492fc27af43d79eb5937cefc278e99d74c007881df07eaba55f5a272044e477fde','awNJWhjMGhXaNvWAOEFKH-') "
8
2016-11-09 11:00:38,327 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) DEBUG - Found mapping for [POST] path=/user/register : UserModule.register(UserModule.java:26)
2016-11-09 11:00:38,327 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'userModule'<class weekly.modules.UserModule>
2016-11-09 11:00:38,329 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - INSERT INTO t_user(username,password,salt) VALUES(?,?,?) 
    |    1 |                                                                                                                                2 |                      3 |
    |------|----------------------------------------------------------------------------------------------------------------------------------|------------------------|
    | 岛田半藏 | d9591eff233d216241259b92d66e9c77528edb9a97aaefdbec9db3455a5da9d773c7799a0335c9c4b8085228ccfdd18c9f2aed9fe27c9c2bd344a6ec2b0ccfd4 | eqmOXWm7HdqqMS2Q3hpO_- |
  For example:> "INSERT INTO t_user(username,password,salt) VALUES('岛田半藏','d9591eff233d216241259b92d66e9c77528edb9a97aaefdbec9db3455a5da9d773c7799a0335c9c4b8085228ccfdd18c9f2aed9fe27c9c2bd344a6ec2b0ccfd4','eqmOXWm7HdqqMS2Q3hpO_-') "
9

8,9是我答应的userid

我本地测试, 重复的name是会抛出Duplicate entry的:

dao.create(User.class, false);

dao.insert(new User("wendal", ....));
dao.insert(new User("wendal", ....));

11:05:52.739 DEBUG (NutDaoExecutor.java:388) printSQL - CREATE TABLE t_user(
id INT(32),
name VARCHAR(50) UNIQUE NOT NULL,
passwd VARCHAR(128),
salt VARCHAR(50),
locked BOOLEAN,
ct DATETIME,
ut DATETIME,
PRIMARY KEY (id)
) ENGINE=InnoDB CHARSET=utf8
org.nutz.dao.DaoException: !Nutz SQL Error: 'INSERT INTO t_user(name,passwd,salt,locked,ct,ut) VALUES('wendal','f332a8fd2315a0fa21adbc25fc9fc6c239fc97b16d33fa74ff898f92a6bef51a','dc39d4c131b941db943fed3f1968f475',false,'2016-11-09 11:05:54','2016-11-09 11:05:54') '
PreparedStatement: 
'INSERT INTO t_user(name,passwd,salt,locked,ct,ut) VALUES(?,?,?,?,?,?) '
CaseMessage=Duplicate entry 'wendal' for key 'name'
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:102) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.dao.impl.interceptor.DaoTimeInterceptor.filter(DaoTimeInterceptor.java:23) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.plugins.cache.dao.DaoCacheInterceptor._exec(DaoCacheInterceptor.java:28) ~[nutz-plugins-daocache-1.r.58.jar:?]
	at org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:96) ~[nutz-plugins-daocache-1.r.58.jar:?]
	at org.nutz.plugins.cache.dao.DaoCacheInterceptor.filter(DaoCacheInterceptor.java:18) ~[nutz-plugins-daocache-1.r.58.jar:?]
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:147) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:93) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:77) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.dao.impl.sql.run.NutDaoRunner$1.run(NutDaoRunner.java:63) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.trans.Trans.exec(Trans.java:174) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:61) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:234) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:242) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.dao.impl.EntityOperator.exec(EntityOperator.java:50) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.dao.impl.NutDao.insert(NutDao.java:157) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at net.wendal.nutzbook.service.UserService.add(UserService.java:35) ~[classes/:?]
	at net.wendal.nutzbook.service.UserService$$NUTZAOP._aop_invoke(UserService.java:1) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:77) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:57) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at net.wendal.nutzbook.service.syslog.SysLogAopInterceptor.filter(SysLogAopInterceptor.java:59) ~[classes/:?]
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at net.wendal.nutzbook.service.UserService$$NUTZAOP.add(UserService.java:1) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at net.wendal.nutzbook.MainSetup.init(MainSetup.java:209) ~[classes/:?]
	at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:277) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:121) [nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19) [nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.mvc.NutFilter._init(NutFilter.java:87) [nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.mvc.NutFilter.init(NutFilter.java:65) [nutz-1.r.59-SNAPSHOT.jar:?]
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279) [catalina.jar:9.0.0.M9]
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260) [catalina.jar:9.0.0.M9]
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105) [catalina.jar:9.0.0.M9]
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4561) [catalina.jar:9.0.0.M9]
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5203) [catalina.jar:9.0.0.M9]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152) [catalina.jar:9.0.0.M9]
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724) [catalina.jar:9.0.0.M9]
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700) [catalina.jar:9.0.0.M9]
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) [catalina.jar:9.0.0.M9]
	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:596) [catalina.jar:9.0.0.M9]
	at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1805) [catalina.jar:9.0.0.M9]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_112]
	at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_112]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_112]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_112]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_112]
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'wendal' for key 'name'
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_112]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_112]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_112]
	at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_112]
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:404) ~[mysql-connector-java-5.1.39.jar:5.1.39]
	at com.mysql.jdbc.Util.getInstance(Util.java:387) ~[mysql-connector-java-5.1.39.jar:5.1.39]
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:934) ~[mysql-connector-java-5.1.39.jar:5.1.39]
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966) ~[mysql-connector-java-5.1.39.jar:5.1.39]
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902) ~[mysql-connector-java-5.1.39.jar:5.1.39]
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526) ~[mysql-connector-java-5.1.39.jar:5.1.39]
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673) ~[mysql-connector-java-5.1.39.jar:5.1.39]
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549) ~[mysql-connector-java-5.1.39.jar:5.1.39]
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861) ~[mysql-connector-java-5.1.39.jar:5.1.39]
	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1192) ~[mysql-connector-java-5.1.39.jar:5.1.39]
	at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2931) ~[druid-1.0.25.jar:1.0.25]
	at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440) ~[druid-1.0.25.jar:1.0.25]
	at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929) ~[druid-1.0.25.jar:1.0.25]
	at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:131) ~[druid-1.0.25.jar:1.0.25]
	at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493) ~[druid-1.0.25.jar:1.0.25]
	at org.nutz.dao.impl.sql.run.NutDaoExecutor._runPreparedStatement(NutDaoExecutor.java:308) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:90) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	... 49 more

@wendal 能该我看下dao.js的配置吗?

https://github.com/wendal/nutz-book-project/blob/master/src/main/resources/ioc/dao.js

测的就是nutzcn的代码.

按理说, 建表语句里面有"username VARCHAR(50) UNIQUE NOT NULL", 如果还能插入重复, 要么连错数据库,要么数据库本身有问题?

然后又试了postgresql,在migration的时候报错:

2016-11-09 13:43:53,756 com.alibaba.druid.filter.stat.StatFilter.mergeSql(StatFilter.java:147) ERROR - merge sql error, dbType postgresql, sql : 
show index from t_user
com.alibaba.druid.sql.parser.ParserException: syntax error, error in :'ndex from t_user',expect FROM, actual FROM from
	at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:239)
	at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:431)
	at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:148)
	at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:143)
	at com.alibaba.druid.sql.visitor.ParameterizedOutputVisitorUtils.parameterize(ParameterizedOutputVisitorUtils.java:54)
	at com.alibaba.druid.filter.stat.StatFilter.mergeSql(StatFilter.java:145)
	at com.alibaba.druid.filter.stat.StatFilter.createSqlStat(StatFilter.java:630)
	at com.alibaba.druid.filter.stat.StatFilter.statementPrepareAfter(StatFilter.java:305)
	at com.alibaba.druid.filter.FilterEventAdapter.connection_prepareStatement(FilterEventAdapter.java:124)
	at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:448)
	at com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl.prepareStatement(ConnectionProxyImpl.java:342)
	at com.alibaba.druid.pool.DruidPooledConnection.prepareStatement(DruidPooledConnection.java:331)
	at org.nutz.dao.util.Daos$4.invoke(Daos.java:841)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:147)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithoutTransaction(NutDaoRunner.java:114)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:81)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:70)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:266)
	at org.nutz.dao.util.Daos.migration(Daos.java:766)
	at org.nutz.dao.util.Daos.migration(Daos.java:1042)
	at weekly.MainSetup.init(MainSetup.java:15)
	at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:277)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:121)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:87)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:65)
	at weekly.mvc.WeeklyNutFilter.init(WeeklyNutFilter.java:22)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4561)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5203)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1403)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
2016-11-09 13:43:53,757 org.nutz.dao.util.Daos$4.invoke(Daos.java:850) DEBUG - migration Table 't_user' fail!
org.postgresql.util.PSQLException: ERROR: syntax error at or near "from"
  位置:12
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2458)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2158)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:291)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:432)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:358)
	at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:171)
	at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:119)
	at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeQuery(FilterChainImpl.java:2714)
	at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_executeQuery(FilterEventAdapter.java:465)
	at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeQuery(FilterChainImpl.java:2711)
	at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.executeQuery(PreparedStatementProxyImpl.java:145)
	at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeQuery(DruidPooledPreparedStatement.java:227)
	at org.nutz.dao.util.Daos$4.invoke(Daos.java:842)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:147)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithoutTransaction(NutDaoRunner.java:114)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:81)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:70)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:266)
	at org.nutz.dao.util.Daos.migration(Daos.java:766)
	at org.nutz.dao.util.Daos.migration(Daos.java:1042)
	at weekly.MainSetup.init(MainSetup.java:15)
	at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:277)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:121)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:87)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:65)
	at weekly.mvc.WeeklyNutFilter.init(WeeklyNutFilter.java:22)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4561)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5203)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1403)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

@wendal 问题找到了,在mainsetup里面写了

Daos.createTablesInPackage(dao, "weekly.bean", false);
		// Daos.migration(dao, "weekly.bean", true, true, true);

migration会引发ALTER TABLE t_user DROP INDEX username

@qq_c1bab051 我试试重新

重现了, 你报个issue?

@Column("userid")
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
@Prev(els = {@EL("uuid()")})
private String userid;

在update的时候会报错 不知道是不是 id不能改名字

rg.nutz.lang.FailToGetValueException: Fail to get value for [cn.wizzer.modules.back.quanyou.models.Quanyou_user]->[id]
	at org.nutz.lang.Mirror.makeGetValueException(Mirror.java:763)
	at org.nutz.lang.Mirror.getValue(Mirror.java:826)
	at org.nutz.el.opt.object.AccessOpt.calculate(AccessOpt.java:46)
	at org.nutz.el.arithmetic.RPN.calculate(RPN.java:55)
	at org.nutz.el.arithmetic.RPN.calculate(RPN.java:38)
	at org.nutz.el.El.eval(El.java:30)

最后发现是slog注解写错

@sunhai1988 恩,slog注解写错. 与本帖子不是同一个问题

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