public int executeUpdateSql ( String sql , PropertyDesc [ ] propDescs , Object entity ) { PreparedStatement stmt = null ; ResultSet rs = null ; try { Connection conn = connectionProvider . getConnection ( ) ; if ( logger . isDebugEnabled ( ) ) { printSql ( sql ) ; printParameters ( propDescs ) ; } if ( entity != null && dialect . supportsGenerationType ( GenerationType . IDENTITY ) ) { stmt = conn . prepareStatement ( sql , PreparedStatement . RETURN_GENERATED_KEYS ) ; } else { stmt = conn . prepareStatement ( sql ) ; } setParameters ( stmt , propDescs , entity ) ; int result = stmt . executeUpdate ( ) ; // Sets GenerationType.IDENTITY properties value. if ( entity != null && dialect . supportsGenerationType ( GenerationType . IDENTITY ) ) { rs = stmt . getGeneratedKeys ( ) ; fillIdentityPrimaryKeys ( entity , rs ) ; } return result ; } catch ( SQLException ex ) { throw new SQLRuntimeException ( ex ) ; } finally { JdbcUtil . close ( rs ) ; JdbcUtil . close ( stmt ) ; } }
Executes an update SQL .