Added loadAll().
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1788 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user