Let's get crazy convenient!

git-svn-id: https://samskivert.googlecode.com/svn/trunk@1506 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2004-09-23 16:55:11 +00:00
parent 4ef11efe20
commit b34c1a3265
@@ -54,8 +54,8 @@ public abstract class JORARepository extends SimpleRepository
} }
/** /**
* Updates the specified field in the supplied object which must * Updates the specified field in the supplied object (which must
* correspond to the supplied table. * correspond to the supplied table).
*/ */
protected void updateField ( protected void updateField (
final Table table, final Object object, String field) final Table table, final Object object, String field)
@@ -73,6 +73,28 @@ public abstract class JORARepository extends SimpleRepository
}); });
} }
/**
* Updates the specified fields in the supplied object (which must
* correspond to the supplied table).
*/
protected void updateFields (
final Table table, final Object object, String[] fields)
throws PersistenceException
{
final FieldMask mask = table.getFieldMask();
for (int ii = 0; ii < fields.length; ii++) {
mask.setModified(fields[ii]);
}
execute(new Operation() {
public Object invoke (Connection conn, DatabaseLiaison liaison)
throws SQLException, PersistenceException
{
table.update(object, mask);
return null;
}
});
}
/** /**
* After the database session is begun, this function will be called * After the database session is begun, this function will be called
* to give the repository implementation the opportunity to create its * to give the repository implementation the opportunity to create its