View Javadoc

1   package org.apache.ojb.broker.accesslayer;
2   
3   /* Copyright 2002-2005 The Apache Software Foundation
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  import org.apache.ojb.broker.PersistenceBrokerSQLException;
19  
20  import java.sql.PreparedStatement;
21  import java.sql.SQLException;
22  import java.sql.Statement;
23  import java.sql.Connection;
24  
25  /**
26    * A class that implements this interface serves as a cache for 
27    * <code>java.sql.Statements<code> used for persistence operations
28    * on a given class. 
29    * @author brj
30    * @author <a href="mailto:rburt3@mchsi.com">Randall Burt</a>
31    * @version $Id: StatementsForClassIF.java,v 1.1 2007-08-24 22:17:30 ewestfal Exp $
32    */
33  
34  public interface StatementsForClassIF
35  {
36  	/**
37       * Returns the DELETE Statement used for clazz.
38       * @return java.sql.PreparedStatement
39       */
40  	PreparedStatement getDeleteStmt(Connection con) throws SQLException;
41  
42  	/**
43       * Returns a generic unprepared Statement used for clazz.
44       * Never use this method for UPDATE/INSERT/DELETE if you want to use the batch mode.
45       * @return java.sql.Statement
46       */
47  	Statement getGenericStmt(Connection con, boolean scrollable) throws PersistenceBrokerSQLException;
48  
49  	/**
50       * Returns the INSERT Statement used for clazz.
51       * @return java.sql.PreparedStatement
52       */
53  
54  	PreparedStatement getInsertStmt(Connection con) throws SQLException;
55  
56  	/**
57       * Returns a prepared Statement used for clazz.
58       * @return java.sql.Statement
59       */
60  	PreparedStatement getPreparedStmt(Connection con, String sql,
61                                        boolean scrollable, int explicitFetchSizeHint, boolean callableStmt)
62              throws PersistenceBrokerSQLException;
63  
64  	/**
65       * Returns the SELECT Statement used for clazz.
66       * @return java.sql.PreparedStatement
67       */
68  	PreparedStatement getSelectByPKStmt(Connection con) throws SQLException;
69  
70  	/**
71       * Returns the UPDATE Statement used for clazz.
72       * @return java.sql.PreparedStatement
73       */
74  	PreparedStatement getUpdateStmt(Connection con) throws SQLException;
75  }