Commit d6d27e68 authored by Quxl's avatar Quxl

x

parent 28f9bf78
package com.egolm.common.jdbc; package com.egolm.common.jdbc;
import java.beans.MethodDescriptor;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.sql.CallableStatement; import java.sql.CallableStatement;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
...@@ -207,9 +209,12 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate { ...@@ -207,9 +209,12 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
Field[] fields = obj.getClass().getDeclaredFields(); Field[] fields = obj.getClass().getDeclaredFields();
for(Field field : fields) { for(Field field : fields) {
Object fieldValue = ReflexUtil.getFieldValue(field, obj); int mod = field.getModifiers();
if(fieldValue != null) { if(!Modifier.isStatic(mod) && !Modifier.isFinal(mod)) {
map.put(field.getName(), fieldValue); Object fieldValue = ReflexUtil.getFieldValue(field, obj);
if(fieldValue != null) {
map.put(field.getName(), fieldValue);
}
} }
} }
return this.updateByColumn(iSql.getName(), iSql.getColumnPkNames(), map); return this.updateByColumn(iSql.getName(), iSql.getColumnPkNames(), map);
......
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