KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > jdbc > core > BatchPreparedStatementSetter


1 /*
2  * Copyright 2002-2006 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.jdbc.core;
18
19 import java.sql.PreparedStatement JavaDoc;
20 import java.sql.SQLException JavaDoc;
21
22 /**
23  * Callback interface used by the JdbcTemplate class.
24  *
25  * <p>This interface sets values on a PreparedStatement provided by the
26  * JdbcTemplate class for each of a number of updates in a batch using the
27  * same SQL. Implementations are responsible for setting any necessary
28  * parameters. SQL with placeholders will already have been supplied.
29  *
30  * <p>Implementations <i>do not</i> need to concern themselves with
31  * SQLExceptions that may be thrown from operations they attempt.
32  * The JdbcTemplate class will catch and handle SQLExceptions appropriately.
33  *
34  * @author Rod Johnson
35  * @since March 2, 2003
36  * @see JdbcTemplate#batchUpdate(String, BatchPreparedStatementSetter)
37  * @see InterruptibleBatchPreparedStatementSetter
38  */

39 public interface BatchPreparedStatementSetter {
40
41     /**
42     * Set values on the given PreparedStatement.
43     * @param ps PreparedStatement we'll invoke setter methods on
44     * @param i index of the statement we're issuing in the batch, starting from 0
45     * @throws SQLException there is no need to catch SQLExceptions
46     * that may be thrown in the implementation of this method.
47     * The JdbcTemplate class will handle them.
48     */

49     void setValues(PreparedStatement JavaDoc ps, int i) throws SQLException JavaDoc;
50     
51     /**
52      * Return the size of the batch.
53      */

54     int getBatchSize();
55
56 }
57
Popular Tags