001 package org.apache.ojb.broker.accesslayer;
002
003 /* Copyright 2002-2005 The Apache Software Foundation
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018 import org.apache.ojb.broker.PersistenceBrokerSQLException;
019
020 import java.sql.PreparedStatement;
021 import java.sql.SQLException;
022 import java.sql.Statement;
023 import java.sql.Connection;
024
025 /**
026 * A class that implements this interface serves as a cache for
027 * <code>java.sql.Statements<code> used for persistence operations
028 * on a given class.
029 * @author brj
030 * @author <a href="mailto:rburt3@mchsi.com">Randall Burt</a>
031 * @version $Id: StatementsForClassIF.java,v 1.1 2007-08-24 22:17:30 ewestfal Exp $
032 */
033
034 public interface StatementsForClassIF
035 {
036 /**
037 * Returns the DELETE Statement used for clazz.
038 * @return java.sql.PreparedStatement
039 */
040 PreparedStatement getDeleteStmt(Connection con) throws SQLException;
041
042 /**
043 * Returns a generic unprepared Statement used for clazz.
044 * Never use this method for UPDATE/INSERT/DELETE if you want to use the batch mode.
045 * @return java.sql.Statement
046 */
047 Statement getGenericStmt(Connection con, boolean scrollable) throws PersistenceBrokerSQLException;
048
049 /**
050 * Returns the INSERT Statement used for clazz.
051 * @return java.sql.PreparedStatement
052 */
053
054 PreparedStatement getInsertStmt(Connection con) throws SQLException;
055
056 /**
057 * Returns a prepared Statement used for clazz.
058 * @return java.sql.Statement
059 */
060 PreparedStatement getPreparedStmt(Connection con, String sql,
061 boolean scrollable, int explicitFetchSizeHint, boolean callableStmt)
062 throws PersistenceBrokerSQLException;
063
064 /**
065 * Returns the SELECT Statement used for clazz.
066 * @return java.sql.PreparedStatement
067 */
068 PreparedStatement getSelectByPKStmt(Connection con) throws SQLException;
069
070 /**
071 * Returns the UPDATE Statement used for clazz.
072 * @return java.sql.PreparedStatement
073 */
074 PreparedStatement getUpdateStmt(Connection con) throws SQLException;
075 }