summaryrefslogtreecommitdiff
path: root/sql-persistence/src/main/java/io/trygvis/persistence/sql/AbstractTypedQuery.java
diff options
context:
space:
mode:
Diffstat (limited to 'sql-persistence/src/main/java/io/trygvis/persistence/sql/AbstractTypedQuery.java')
-rw-r--r--sql-persistence/src/main/java/io/trygvis/persistence/sql/AbstractTypedQuery.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/sql-persistence/src/main/java/io/trygvis/persistence/sql/AbstractTypedQuery.java b/sql-persistence/src/main/java/io/trygvis/persistence/sql/AbstractTypedQuery.java
index 1cb8405..ab92994 100644
--- a/sql-persistence/src/main/java/io/trygvis/persistence/sql/AbstractTypedQuery.java
+++ b/sql-persistence/src/main/java/io/trygvis/persistence/sql/AbstractTypedQuery.java
@@ -19,20 +19,18 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-public abstract class AbstractTypedQuery<A> implements TypedQuery<A> {
+public abstract class AbstractTypedQuery<A> implements TypedQuery<A> , FromResultSet<A> {
private final Connection c;
- private final SqlEntityDesc sqlEntity;
+ private final SqlEntityMeta sqlEntity;
private int firstResult;
private int maxResults;
- protected AbstractTypedQuery(Connection c, SqlEntityDesc sqlEntity) {
+ protected AbstractTypedQuery(Connection c, SqlEntityMeta sqlEntity) {
this.c = c;
this.sqlEntity = sqlEntity;
}
- public abstract A fromResultSet(ResultSet rs) throws SQLException;
-
@Override
public TypedQuery<A> setMaxResults(int maxResult) {
this.maxResults = maxResult;
@@ -192,10 +190,10 @@ public abstract class AbstractTypedQuery<A> implements TypedQuery<A> {
public List<A> getResultList(Integer offset, Integer limit) {
String sql = "SELECT " + sqlEntity.defaultFields + " FROM " + sqlEntity.tableName;
- if(offset != null) {
+ if (offset != null) {
sql += " OFFSET " + offset;
}
- if(limit != null) {
+ if (limit != null) {
sql += " LIMIT " + limit;
}