diff --git a/src/java/com/samskivert/jdbc/depot/DepotRepository.java b/src/java/com/samskivert/jdbc/depot/DepotRepository.java index 3bfb3aa..7297176 100644 --- a/src/java/com/samskivert/jdbc/depot/DepotRepository.java +++ b/src/java/com/samskivert/jdbc/depot/DepotRepository.java @@ -25,6 +25,7 @@ import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.Arrays; +import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Set; @@ -122,7 +123,17 @@ public abstract class DepotRepository } /** - * Loads the first persistent object that matches the supplied key. + * Loads the first persistent object that matches the supplied query clauses. + */ + protected T load ( + Class type, Collection clauses) + throws PersistenceException + { + return load(type, clauses.toArray(new QueryClause[clauses.size()])); + } + + /** + * Loads the first persistent object that matches the supplied query clauses. */ protected T load (Class type, QueryClause... clauses) throws PersistenceException @@ -142,7 +153,8 @@ public abstract class DepotRepository * complexity is an inherent drawback, and it does execute two separate database queries * for what the simple method does in one. */ - protected List findAll (Class type, List clauses) + protected List findAll ( + Class type, Collection clauses) throws PersistenceException { DepotMarshaller marsh = _ctx.getMarshaller(type); @@ -160,7 +172,7 @@ public abstract class DepotRepository } /** - * A varargs version of {@link #findAll(Class,List)}. + * A varargs version of {@link #findAll(Class,Collection)}. */ protected List findAll (Class type, QueryClause... clauses) throws PersistenceException diff --git a/src/java/com/samskivert/jdbc/depot/DepotTypes.java b/src/java/com/samskivert/jdbc/depot/DepotTypes.java index ac1e18d..e416636 100644 --- a/src/java/com/samskivert/jdbc/depot/DepotTypes.java +++ b/src/java/com/samskivert/jdbc/depot/DepotTypes.java @@ -55,7 +55,7 @@ public class DepotTypes * are interrogated for their class definition sets through {@link SQLExpression#addClasses}. */ public static DepotTypes getDepotTypes ( - PersistenceContext ctx, Collection clauses) + PersistenceContext ctx, Collection clauses) throws PersistenceException { Set> classSet = diff --git a/src/java/com/samskivert/jdbc/depot/FindAllQuery.java b/src/java/com/samskivert/jdbc/depot/FindAllQuery.java index 51adb3a..976299d 100644 --- a/src/java/com/samskivert/jdbc/depot/FindAllQuery.java +++ b/src/java/com/samskivert/jdbc/depot/FindAllQuery.java @@ -24,7 +24,9 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; + import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -59,7 +61,8 @@ public abstract class FindAllQuery */ public static class WithCache extends FindAllQuery { - public WithCache (PersistenceContext ctx, Class type, List clauses) + public WithCache (PersistenceContext ctx, Class type, + Collection clauses) throws PersistenceException { super(ctx, type); @@ -192,7 +195,7 @@ public abstract class FindAllQuery } } - protected List _clauses; + protected Collection _clauses; } /** @@ -200,7 +203,8 @@ public abstract class FindAllQuery */ public static class Explicitly extends FindAllQuery { - public Explicitly (PersistenceContext ctx, Class type, List clauses) + public Explicitly (PersistenceContext ctx, Class type, + Collection clauses) throws PersistenceException { super(ctx, type); diff --git a/src/java/com/samskivert/jdbc/depot/clause/SelectClause.java b/src/java/com/samskivert/jdbc/depot/clause/SelectClause.java index 3489929..b081d9f 100644 --- a/src/java/com/samskivert/jdbc/depot/clause/SelectClause.java +++ b/src/java/com/samskivert/jdbc/depot/clause/SelectClause.java @@ -42,7 +42,7 @@ public class SelectClause extends QueryClause * class, as dictated by the key and query clauses. A persistence context is supplied for * instantiation of marshallers, which may trigger table creations and schema migrations. */ - public SelectClause (Class pClass, String[] fields, List clauses) + public SelectClause (Class pClass, String[] fields, Collection clauses) { _pClass = pClass; _fields = fields;