A very handy method.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1505 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -22,6 +22,7 @@ package com.samskivert.jdbc;
|
|||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
|
||||||
|
import com.samskivert.io.PersistenceException;
|
||||||
import com.samskivert.jdbc.jora.*;
|
import com.samskivert.jdbc.jora.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,6 +53,26 @@ public abstract class JORARepository extends SimpleRepository
|
|||||||
createTables(_session);
|
createTables(_session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the specified field in the supplied object which must
|
||||||
|
* correspond to the supplied table.
|
||||||
|
*/
|
||||||
|
protected void updateField (
|
||||||
|
final Table table, final Object object, String field)
|
||||||
|
throws PersistenceException
|
||||||
|
{
|
||||||
|
final FieldMask mask = table.getFieldMask();
|
||||||
|
mask.setModified(field);
|
||||||
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user