public boolean noteTransition ( Class < ? > clazz , final String name ) throws PersistenceException { final String cname = clazz . getName ( ) ; return executeUpdate ( new Operation < Boolean > ( ) { public Boolean invoke ( Connection conn , DatabaseLiaison liaison ) throws SQLException , PersistenceException { PreparedStatement stmt = null ; try { stmt = conn . prepareStatement ( "insert into " + liaison . tableSQL ( "TRANSITIONS" ) + " (" + liaison . columnSQL ( "CLASS" ) + ", " + liaison . columnSQL ( "NAME" ) + ", " + liaison . columnSQL ( "APPLIED" ) + ") values (?, ?, ?)" ) ; stmt . setString ( 1 , cname ) ; stmt . setString ( 2 , name ) ; stmt . setTimestamp ( 3 , new Timestamp ( System . currentTimeMillis ( ) ) ) ; JDBCUtil . checkedUpdate ( stmt , 1 ) ; return true ; } catch ( SQLException sqe ) { if ( liaison . isDuplicateRowException ( sqe ) ) { return false ; } else { throw sqe ; } } finally { JDBCUtil . close ( stmt ) ; } } } ) ; }
Note in the database that a particular transition has been applied .