aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/com/iciql/DaoProxy.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2015-04-16 19:47:27 -0400
committerJames Moger <james.moger@gitblit.com>2015-04-16 20:06:15 -0400
commite670abca93ddc6455ab75a01cfdd07abc3b3e9ad (patch)
treec92616711ce399142c69286c685fd834eca2359f /src/main/java/com/iciql/DaoProxy.java
parent5f71b4c044a382b89bd05577ef6fed86ed593c31 (diff)
downloadiciql-e670abca93ddc6455ab75a01cfdd07abc3b3e9ad.tar.gz
iciql-e670abca93ddc6455ab75a01cfdd07abc3b3e9ad.zip
Use JavaType as the key for DataTypeAdapter registration
Diffstat (limited to 'src/main/java/com/iciql/DaoProxy.java')
-rw-r--r--src/main/java/com/iciql/DaoProxy.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main/java/com/iciql/DaoProxy.java b/src/main/java/com/iciql/DaoProxy.java
index 34187c4..deebeca 100644
--- a/src/main/java/com/iciql/DaoProxy.java
+++ b/src/main/java/com/iciql/DaoProxy.java
@@ -193,13 +193,18 @@ final class DaoProxy<X extends Dao> implements InvocationHandler, Dao {
} else {
// query of (array of) standard Java type or a DataTypeAdapter type
+ if (adapter != null) {
+ DataTypeAdapter<?> dta = Utils.newObject(adapter);
+ db.getDialect().registerAdapter(dta);
+ }
+
objects = Utils.newArrayList();
ResultSet rs = db.executeQuery(preparedSql.sql, preparedSql.parameters);
try {
while (rs.next()) {
- Object value = db.getDialect().deserialize(rs, 1, returnType, adapter);
+ Object value = db.getDialect().deserialize(rs, 1, returnType);
objects.add(value);
if (!isArray) {
@@ -683,8 +688,13 @@ final class DaoProxy<X extends Dao> implements InvocationHandler, Dao {
typeAdapter = Utils.getDataTypeAdapter(methodArg.getClass().getAnnotations());
}
+ if (typeAdapter != null) {
+ DataTypeAdapter<?> dta = Utils.newObject(typeAdapter);
+ db.getDialect().registerAdapter(dta);
+ }
+
// prepare the parameter
- parameters[i] = db.getDialect().serialize(value, typeAdapter);
+ parameters[i] = db.getDialect().serialize(value);
}