update map集合怎么添加where条件?update是不是只是更新map集合中自己添加的字段呢?
10 回复
map.put(".table","user");
map.put("name","tom");
dao.update(map, Cnd.where("id","=",1));
Exception in thread "main" org.nutz.dao.DaoException: !Nutz SQL Error: 'UPDATE user SET name='tom' AND (id1=1)'
PreparedStatement:
'UPDATE user SET name=? AND (id1=?)'
CaseMessage=Data truncation: Truncated incorrect DOUBLE value: 'tom'
请问这么不对吗?
18-03-08 10:58:09.985 DEBUG [main] UPDATE user SET name=? AND (name=?)
| 1 | 2 |
|-----|---|
| tom | 1 |
For example:> "UPDATE user SET name='tom' AND (name=1)"
18-03-08 10:58:09.994 DEBUG [main] SQLException
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: 'tom'
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3968)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3906)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2677)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1192)
at org.nutz.dao.impl.sql.run.NutDaoExecutor._runPreparedStatement(NutDaoExecutor.java:308)
at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:90)
at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66)
at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22)
at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64)
at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139)
at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:158)
at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithoutTransaction(NutDaoRunner.java:125)
at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:92)
at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:81)
at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:240)
at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:252)
at org.nutz.dao.impl.EntityOperator.exec(EntityOperator.java:55)
at org.nutz.dao.impl.NutDao.update(NutDao.java:318)
at nutz.TestUpdate.main(TestUpdate.java:31)
Exception in thread "main" org.nutz.dao.DaoException: !Nutz SQL Error: 'UPDATE user SET name='tom' AND (name=1)'
PreparedStatement:
'UPDATE user SET name=? AND (name=?)'
CaseMessage=Data truncation: Truncated incorrect DOUBLE value: 'tom'
at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:104)
at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66)
at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22)
at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64)
at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139)
at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:158)
at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithoutTransaction(NutDaoRunner.java:125)
at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:92)
at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:81)
at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:240)
at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:252)
at org.nutz.dao.impl.EntityOperator.exec(EntityOperator.java:55)
at org.nutz.dao.impl.NutDao.update(NutDao.java:318)
at nutz.TestUpdate.main(TestUpdate.java:31)
Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: 'tom'
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3968)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3906)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2677)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1192)
at org.nutz.dao.impl.sql.run.NutDaoExecutor._runPreparedStatement(NutDaoExecutor.java:308)
at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:90)
... 13 more
添加回复
请先登陆