Added loadAll().

git-svn-id: https://samskivert.googlecode.com/svn/trunk@1788 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2006-02-20 21:58:13 +00:00
parent b3049d6a1d
commit d280925985
@@ -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. <em>Note:</em> the query should match one or zero