Return the last inserted id when inserting records.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@1681 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2005-07-24 07:06:58 +00:00
parent aeef770bec
commit c099fb97bb
@@ -57,17 +57,18 @@ public abstract class JORARepository extends SimpleRepository
* Inserts the supplied object into the specified table. The table
* must be configured to store items of the supplied type.
*/
protected void insert (final Table table, final Object object)
protected int insert (final Table table, final Object object)
throws PersistenceException
{
execute(new Operation() {
Integer iid = (Integer)execute(new Operation() {
public Object invoke (Connection conn, DatabaseLiaison liaison)
throws SQLException, PersistenceException
{
table.insert(object);
return null;
return new Integer(liaison.lastInsertedId(conn));
}
});
return iid.intValue();
}
/**