1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.seasar.tuigwaa.database.util;
17
18 import java.sql.Connection;
19 import java.sql.PreparedStatement;
20
21 import org.seasar.extension.jdbc.impl.BasicBatchHandler;
22 import org.seasar.extension.jdbc.util.ConnectionUtil;
23 import org.seasar.framework.exception.SQLRuntimeException;
24 import org.seasar.framework.util.PreparedStatementUtil;
25 import org.seasar.framework.util.StatementUtil;
26
27 /***
28 * @author someda
29 */
30 public class BasicDynaBatchHandler extends BasicBatchHandler implements
31 DynaBatchHandler {
32
33
34 public int execute() throws SQLRuntimeException {
35 Connection connection = getConnection();
36 try {
37 return execute(connection);
38 } finally {
39 ConnectionUtil.close(connection);
40 }
41 }
42
43 protected int execute(Connection connection){
44 PreparedStatement ps = prepareStatement(connection);
45 try {
46 return PreparedStatementUtil.executeUpdate(ps);
47 } finally {
48 StatementUtil.close(ps);
49 }
50 }
51
52 }