org.apache.ojb.broker.accesslayer
Class StatementsForClassImpl

java.lang.Object
  extended byorg.apache.ojb.broker.accesslayer.StatementsForClassImpl
All Implemented Interfaces:
StatementsForClassIF
Direct Known Subclasses:
SQLCachingStatementsForClass

public class StatementsForClassImpl
extends java.lang.Object
implements StatementsForClassIF

This class serves as a cache for Statements that are used for persistence operations on a given class.

Version:
$Id: StatementsForClassImpl.java,v 1.22.2.1 2005/01/13 15:50:05 arminw Exp $
Author:
Thomas Mahler

Constructor Summary
StatementsForClassImpl(JdbcConnectionDescriptor jcd, ClassDescriptor classDescriptor)
           
 
Method Summary
 java.sql.PreparedStatement getDeleteStmt(java.sql.Connection con)
          returns the DELETE Statement used for clazz.
 java.sql.Statement getGenericStmt(java.sql.Connection con, boolean scrollable)
          returns a generic unprepared Statement used for clazz.
 java.sql.PreparedStatement getInsertStmt(java.sql.Connection con)
          returns the INSERT Statement used for clazz.
 java.sql.PreparedStatement getPreparedStmt(java.sql.Connection con, java.lang.String sql, boolean scrollable)
          returns a prepared Statement used for clazz.
 java.sql.PreparedStatement getSelectByPKStmt(java.sql.Connection con)
          returns the SELECT Statement used for clazz.
 java.sql.PreparedStatement getUpdateStmt(java.sql.Connection con)
          returns the UPDATE Statement used for clazz.
 boolean isCached(java.sql.Statement stmt)
          For single VM operation to not eat up Oracle resources, we need to close the statements unless they are cached.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatementsForClassImpl

public StatementsForClassImpl(JdbcConnectionDescriptor jcd,
                              ClassDescriptor classDescriptor)
Method Detail

isCached

public boolean isCached(java.sql.Statement stmt)
Description copied from interface: StatementsForClassIF
For single VM operation to not eat up Oracle resources, we need to close the statements unless they are cached.

Specified by:
isCached in interface StatementsForClassIF
Returns:
if the statement is of type select, insert, update, or delete

getDeleteStmt

public java.sql.PreparedStatement getDeleteStmt(java.sql.Connection con)
                                         throws java.sql.SQLException
Description copied from interface: StatementsForClassIF
returns the DELETE Statement used for clazz.

Specified by:
getDeleteStmt in interface StatementsForClassIF
Returns:
java.sql.PreparedStatement
Throws:
java.sql.SQLException

getGenericStmt

public java.sql.Statement getGenericStmt(java.sql.Connection con,
                                         boolean scrollable)
                                  throws PersistenceBrokerSQLException
Description copied from interface: StatementsForClassIF
returns a generic unprepared Statement used for clazz. Never use this method for UPDATE/INSERT/DELETE if you want to use the batch mode.

Specified by:
getGenericStmt in interface StatementsForClassIF
Returns:
java.sql.Statement
Throws:
PersistenceBrokerSQLException

getInsertStmt

public java.sql.PreparedStatement getInsertStmt(java.sql.Connection con)
                                         throws java.sql.SQLException
Description copied from interface: StatementsForClassIF
returns the INSERT Statement used for clazz.

Specified by:
getInsertStmt in interface StatementsForClassIF
Returns:
java.sql.PreparedStatement
Throws:
java.sql.SQLException

getPreparedStmt

public java.sql.PreparedStatement getPreparedStmt(java.sql.Connection con,
                                                  java.lang.String sql,
                                                  boolean scrollable)
                                           throws PersistenceBrokerSQLException
Description copied from interface: StatementsForClassIF
returns a prepared Statement used for clazz.

Specified by:
getPreparedStmt in interface StatementsForClassIF
Returns:
java.sql.Statement
Throws:
PersistenceBrokerSQLException

getSelectByPKStmt

public java.sql.PreparedStatement getSelectByPKStmt(java.sql.Connection con)
                                             throws java.sql.SQLException
Description copied from interface: StatementsForClassIF
returns the SELECT Statement used for clazz.

Specified by:
getSelectByPKStmt in interface StatementsForClassIF
Returns:
java.sql.PreparedStatement
Throws:
java.sql.SQLException

getUpdateStmt

public java.sql.PreparedStatement getUpdateStmt(java.sql.Connection con)
                                         throws java.sql.SQLException
Description copied from interface: StatementsForClassIF
returns the UPDATE Statement used for clazz.

Specified by:
getUpdateStmt in interface StatementsForClassIF
Returns:
java.sql.PreparedStatement
Throws:
java.sql.SQLException


(C) 2002 - 2004 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.3, 2005-04-2