Example usage for java.sql CallableStatement clearParameters

List of usage examples for java.sql CallableStatement clearParameters

Introduction

In this page you can find the example usage for java.sql CallableStatement clearParameters.

Prototype

void clearParameters() throws SQLException;

Source Link

Document

Clears the current parameter values immediately.

Usage

From source file:org.openestate.tool.helloworld.db.hsql.HSqlDbHelloWorldHandler.java

@Override
public void removeObjects(Connection c, long[] ids) throws SQLException {
    if (ids.length < 1)
        return;/*from   w w w  .j a  v a 2  s .c  om*/
    final boolean oldAutoCommit = c.getAutoCommit();
    CallableStatement removeStatement = null;
    try {
        c.setAutoCommit(false);
        removeStatement = c.prepareCall("CALL " + PROC_REMOVE_HELLOWORLD + "(?);");
        for (long id : ids) {
            removeStatement.clearParameters();
            removeStatement.setLong(1, id);
            removeStatement.execute();
        }
        c.commit();
    } catch (SQLException ex) {
        c.rollback();
        throw ex;
    } finally {
        JdbcUtils.closeQuietly(removeStatement);
        c.setAutoCommit(oldAutoCommit);
    }
}