private void primAdd ( IEntityLock lock , Connection conn ) throws SQLException , LockingException { Integer typeID = EntityTypesLocator . getEntityTypes ( ) . getEntityIDFromType ( lock . getEntityType ( ) ) ; String key = lock . getEntityKey ( ) ; int lockType = lock . getLockType ( ) ; Timestamp ts = new Timestamp ( lock . getExpirationTime ( ) . getTime ( ) ) ; String owner = lock . getLockOwner ( ) ; try { PreparedStatement ps = conn . prepareStatement ( getAddSql ( ) ) ; try { ps . setInt ( 1 , typeID . intValue ( ) ) ; // entity type ps . setString ( 2 , key ) ; // entity key ps . setInt ( 3 , lockType ) ; // lock type ps . setTimestamp ( 4 , ts ) ; // lock expiration ps . setString ( 5 , owner ) ; // lock owner if ( log . isDebugEnabled ( ) ) log . debug ( "RDBMEntityLockStore.primAdd(): " + ps ) ; int rc = ps . executeUpdate ( ) ; if ( rc != 1 ) { String errString = "Problem adding " + lock ; log . error ( errString ) ; throw new LockingException ( errString ) ; } } finally { if ( ps != null ) ps . close ( ) ; } } catch ( java . sql . SQLException sqle ) { log . error ( sqle , sqle ) ; throw sqle ; } }
Add the lock to the underlying store .