/** * Execute the statement * @return the number of rows modified */ public int execute() { try { return this.internalExecute(new QueryResultMunger<Integer>() { public Integer munge(Statement results) throws SQLException { return results.getUpdateCount(); } }); } finally { cleanup(); } }
/** * Execute the statement * @return the number of rows modified */ public int execute() { try { return this.internalExecute(new QueryResultMunger<Integer>() { @Override public Integer munge(Statement results) throws SQLException { return results.getUpdateCount(); } }); } finally { cleanup(); } }
/** * Execute the statement and returns any auto-generated keys. This requires the JDBC driver to support * the {@link Statement#getGeneratedKeys()} method. * @param mapper the mapper to generate the resulting key object * @return the generated key or null if none was returned */ public <GeneratedKeyType> GeneratedKeys<GeneratedKeyType> executeAndReturnGeneratedKeys(final ResultSetMapper<GeneratedKeyType> mapper) { getConcreteContext().setReturningGeneratedKeys(true); return this.internalExecute(new QueryResultMunger<GeneratedKeys<GeneratedKeyType>>() { public GeneratedKeys<GeneratedKeyType> munge(Statement results) throws SQLException { return new GeneratedKeys<GeneratedKeyType>(mapper, Update.this, results, getContext(), getContainerMapperRegistry()); } }); }
/** * Execute the statement and returns any auto-generated keys. This requires the JDBC driver to support * the {@link Statement#getGeneratedKeys()} method. * @param mapper the mapper to generate the resulting key object * @return the generated key or null if none was returned */ public <GeneratedKeyType> GeneratedKeys<GeneratedKeyType> executeAndReturnGeneratedKeys(final ResultSetMapper<GeneratedKeyType> mapper) { getConcreteContext().setReturningGeneratedKeys(true); return this.internalExecute(new QueryResultMunger<GeneratedKeys<GeneratedKeyType>>() { @Override public GeneratedKeys<GeneratedKeyType> munge(Statement results) throws SQLException { return new GeneratedKeys<GeneratedKeyType>(mapper, Update.this, results, getContext(), getContainerMapperRegistry()); } }); }