Propagate more modified row counts.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@1825 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2006-04-13 18:43:44 +00:00
parent e6c4008258
commit 9946c3e311
@@ -208,19 +208,20 @@ 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).
*
* @return the number of rows modified by the update.
*/ */
protected <T> void updateField ( protected <T> int updateField (
final Table<T> table, final T object, String field) final Table<T> table, final T object, String field)
throws PersistenceException throws PersistenceException
{ {
final FieldMask mask = table.getFieldMask(); final FieldMask mask = table.getFieldMask();
mask.setModified(field); mask.setModified(field);
executeUpdate(new Operation<Object>() { return executeUpdate(new Operation<Integer>() {
public Object invoke (Connection conn, DatabaseLiaison liaison) public Integer invoke (Connection conn, DatabaseLiaison liaison)
throws SQLException, PersistenceException throws SQLException, PersistenceException
{ {
table.update(object, mask); return table.update(object, mask);
return null;
} }
}); });
} }
@@ -228,8 +229,10 @@ public abstract class JORARepository extends SimpleRepository
/** /**
* Updates the specified fields in the supplied object (which must * Updates the specified fields in the supplied object (which must
* correspond to the supplied table). * correspond to the supplied table).
*
* @return the number of rows modified by the update.
*/ */
protected <T> void updateFields ( protected <T> int updateFields (
final Table<T> table, final T object, String[] fields) final Table<T> table, final T object, String[] fields)
throws PersistenceException throws PersistenceException
{ {
@@ -237,25 +240,28 @@ public abstract class JORARepository extends SimpleRepository
for (int ii = 0; ii < fields.length; ii++) { for (int ii = 0; ii < fields.length; ii++) {
mask.setModified(fields[ii]); mask.setModified(fields[ii]);
} }
executeUpdate(new Operation<Object>() { return executeUpdate(new Operation<Integer>() {
public Object invoke (Connection conn, DatabaseLiaison liaison) public Integer invoke (Connection conn, DatabaseLiaison liaison)
throws SQLException, PersistenceException throws SQLException, PersistenceException
{ {
table.update(object, mask); return table.update(object, mask);
return null;
} }
}); });
} }
protected <T> void delete (final Table<T> table, final T object) /**
* Deletes the specified object from the table.
*
* @return the number of rows deleted.
*/
protected <T> int delete (final Table<T> table, final T object)
throws PersistenceException throws PersistenceException
{ {
executeUpdate(new Operation<Object>() { return executeUpdate(new Operation<Integer>() {
public Object invoke (Connection conn, DatabaseLiaison liaison) public Integer invoke (Connection conn, DatabaseLiaison liaison)
throws SQLException, PersistenceException throws SQLException, PersistenceException
{ {
table.delete(object); return table.delete(object);
return null;
} }
}); });
} }