Added a loadByExample() variant that takes a field mask.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1682 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -122,6 +122,24 @@ public abstract class JORARepository extends SimpleRepository
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a single object from the specified table that matches the
|
||||
* supplied example. <em>Note:</em> the query should match one or zero
|
||||
* records, not more.
|
||||
*/
|
||||
protected Object loadByExample (
|
||||
final Table table, final FieldMask mask, final Object example)
|
||||
throws PersistenceException
|
||||
{
|
||||
return execute(new Operation() {
|
||||
public Object invoke (Connection conn, DatabaseLiaison liaison)
|
||||
throws SQLException, PersistenceException
|
||||
{
|
||||
return table.queryByExample(example, mask).next();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* First attempts to update the supplied object and if that modifies
|
||||
* zero rows, inserts the object into the specified table. The table
|
||||
|
||||
Reference in New Issue
Block a user