JDBC provides a transaction API using connection.setAutoCommit() - not sure it's supported by all database types, but if it's not then I don't think we should worry about it.

As for getting the last insert id, using max() is far from optimal yes i agree.  we could add something to the database interface to handle this more neatly, wrapping this possibly...

http://docs.oracle.com/javase/6/docs/api/java/sql/Statement.html#executeUpdate%28java.lang.String,%20int%29

(using the generated keys constant i mean).