Commit efb7715d authored by Quxl's avatar Quxl

x

parent e0be76b0
......@@ -258,7 +258,12 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate {
String[] pks = desc.getFieldPkNames();
if(pks != null && pks.length > 0) {
if(ReflexUtil.readField(pks[0], obj) == null) {
ReflexUtil.writeField(pks[0], obj, keyHolder.getKey());
Object key = keyHolder.getKey();
try {
ReflexUtil.writeField(pks[0], obj, key);
} catch (ClassCastException e) {
throw new RuntimeException("设置自增主键:field=" + pks[0] + ",value=" + key + ",class=" + key.getClass() + "错误");
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment