diff options
author | James Moger <james.moger@gitblit.com> | 2015-04-16 19:47:27 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2015-04-16 20:06:15 -0400 |
commit | e670abca93ddc6455ab75a01cfdd07abc3b3e9ad (patch) | |
tree | c92616711ce399142c69286c685fd834eca2359f /src/main/java/com/iciql/Query.java | |
parent | 5f71b4c044a382b89bd05577ef6fed86ed593c31 (diff) | |
download | iciql-e670abca93ddc6455ab75a01cfdd07abc3b3e9ad.tar.gz iciql-e670abca93ddc6455ab75a01cfdd07abc3b3e9ad.zip |
Use JavaType as the key for DataTypeAdapter registration
Diffstat (limited to 'src/main/java/com/iciql/Query.java')
-rw-r--r-- | src/main/java/com/iciql/Query.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/com/iciql/Query.java b/src/main/java/com/iciql/Query.java index d52451e..946a460 100644 --- a/src/main/java/com/iciql/Query.java +++ b/src/main/java/com/iciql/Query.java @@ -423,9 +423,13 @@ public class Query<T> { ResultSet rs = stat.executeQuery();
List<X> result = Utils.newArrayList();
Class<? extends DataTypeAdapter<?>> typeAdapter = Utils.getDataTypeAdapter(x.getClass().getAnnotations());
+ if (typeAdapter != null) {
+ DataTypeAdapter<?> dta = Utils.newObject(typeAdapter);
+ db.getDialect().registerAdapter(dta);
+ }
try {
while (rs.next()) {
- X value = (X) db.getDialect().deserialize(rs, 1, x.getClass(), typeAdapter);
+ X value = (X) db.getDialect().deserialize(rs, 1, x.getClass());
result.add(value);
}
} catch (Exception e) {
@@ -840,8 +844,7 @@ public class Query<T> { stat.addParameter(y);
} else if (col != null) {
// object
- Class<? extends DataTypeAdapter<?>> typeAdapter = col.getFieldDefinition().typeAdapter;
- Object parameter = db.getDialect().serialize(value, typeAdapter);
+ Object parameter = db.getDialect().serialize(value);
stat.addParameter(parameter);
} else {
// primitive
|