修复DataSource中json字段不为Serializable时会异常的bug
This commit is contained in:
@@ -177,7 +177,7 @@ public class DataJdbcSource extends DataSqlSource<Connection> {
|
|||||||
protected <T> int batchStatementParameters(Connection conn, PreparedStatement prestmt, EntityInfo<T> info, Attribute<T, Serializable>[] attrs, T entity) throws SQLException {
|
protected <T> int batchStatementParameters(Connection conn, PreparedStatement prestmt, EntityInfo<T> info, Attribute<T, Serializable>[] attrs, T entity) throws SQLException {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Attribute<T, Serializable> attr : attrs) {
|
for (Attribute<T, Serializable> attr : attrs) {
|
||||||
Serializable val = info.getSQLValue(attr, entity);
|
Object val = info.getSQLValue(attr, entity);
|
||||||
if (val instanceof byte[]) {
|
if (val instanceof byte[]) {
|
||||||
Blob blob = conn.createBlob();
|
Blob blob = conn.createBlob();
|
||||||
blob.setBytes(1, (byte[]) val);
|
blob.setBytes(1, (byte[]) val);
|
||||||
|
|||||||
@@ -902,10 +902,10 @@ public final class EntityInfo<T> {
|
|||||||
*
|
*
|
||||||
* @return Object
|
* @return Object
|
||||||
*/
|
*/
|
||||||
public Serializable getSQLValue(Attribute<T, Serializable> attr, T entity) {
|
public <F> Object getSQLValue(Attribute<T, F> attr, T entity) {
|
||||||
Serializable val = attr.get(entity);
|
Object val = attr.get(entity);
|
||||||
CryptHandler cryptHandler = attr.attach();
|
CryptHandler cryptHandler = attr.attach();
|
||||||
if (cryptHandler != null) val = (Serializable) cryptHandler.encrypt(val);
|
if (cryptHandler != null) val = cryptHandler.encrypt(val);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user