From d28092598565e8ed4e6502d470202dc8ec2f1f23 Mon Sep 17 00:00:00 2001 From: mdb Date: Mon, 20 Feb 2006 21:58:13 +0000 Subject: [PATCH] Added loadAll(). git-svn-id: https://samskivert.googlecode.com/svn/trunk@1788 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../com/samskivert/jdbc/JORARepository.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/java/com/samskivert/jdbc/JORARepository.java b/src/java/com/samskivert/jdbc/JORARepository.java index feab65f4..fb6c8581 100644 --- a/src/java/com/samskivert/jdbc/JORARepository.java +++ b/src/java/com/samskivert/jdbc/JORARepository.java @@ -21,6 +21,7 @@ package com.samskivert.jdbc; import java.sql.*; +import java.util.ArrayList; import com.samskivert.io.PersistenceException; import com.samskivert.jdbc.jora.*; @@ -89,6 +90,22 @@ public abstract class JORARepository extends SimpleRepository }); } + /** + * Loads all objects from the specified table that match the supplied + * query. + */ + protected ArrayList loadAll (final Table table, final String query) + throws PersistenceException + { + return (ArrayList)execute(new Operation() { + public Object invoke (Connection conn, DatabaseLiaison liaison) + throws SQLException, PersistenceException + { + return table.select(query).toArrayList(); + } + }); + } + /** * Loads a single object from the specified table that matches the * supplied query. Note: the query should match one or zero