summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/iciql/DaoProxy.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-11-10 11:59:09 -0500
committerJames Moger <james.moger@gitblit.com>2014-11-10 21:46:37 -0500
commita6df2de41953e10db1527e54acd734c0f0a1fa28 (patch)
treead3a86dc2a54cf3ac9418e0e5e86f396f4e1dfb0 /src/main/java/com/iciql/DaoProxy.java
parentc1d81bcdfc948b417964c6b69be2ee5801e5e1c9 (diff)
downloadiciql-a6df2de41953e10db1527e54acd734c0f0a1fa28.tar.gz
iciql-a6df2de41953e10db1527e54acd734c0f0a1fa28.zip
Implement DAO externalized statement loading based on runtime Mode
Diffstat (limited to 'src/main/java/com/iciql/DaoProxy.java')
-rw-r--r--src/main/java/com/iciql/DaoProxy.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/com/iciql/DaoProxy.java b/src/main/java/com/iciql/DaoProxy.java
index db5f911..cafd6f7 100644
--- a/src/main/java/com/iciql/DaoProxy.java
+++ b/src/main/java/com/iciql/DaoProxy.java
@@ -72,7 +72,7 @@ final class DaoProxy<X extends Dao> implements InvocationHandler, Dao {
* @return a proxy object
*/
@SuppressWarnings("unchecked")
- X buildProxy() {
+ X build() {
if (!daoInterface.isInterface()) {
throw new IciqlException("Dao {0} must be an interface!", daoInterface.getName());
@@ -115,12 +115,14 @@ final class DaoProxy<X extends Dao> implements InvocationHandler, Dao {
} else if (method.isAnnotationPresent(SqlQuery.class)) {
String sql = method.getAnnotation(SqlQuery.class).value();
- return executeQuery(method, args, sql);
+ String statement = db.getDaoStatementProvider().getStatement(sql, db.getMode());
+ return executeQuery(method, args, statement);
} else if (method.isAnnotationPresent(SqlStatement.class)) {
String sql = method.getAnnotation(SqlStatement.class).value();
- return executeStatement(method, args, sql);
+ String statement = db.getDaoStatementProvider().getStatement(sql, db.getMode());
+ return executeStatement(method, args, statement);
} else {
@@ -220,6 +222,11 @@ final class DaoProxy<X extends Dao> implements InvocationHandler, Dao {
objects.add(value);
+ if (!isArray) {
+ // we are not returning an array so we break
+ // the loop and return the first result
+ break;
+ }
}
} catch (SQLException e) {