org.apache.ojb.broker.platforms
Class PlatformOracleImpl

java.lang.Object
  extended by org.apache.ojb.broker.platforms.PlatformDefaultImpl
      extended by org.apache.ojb.broker.platforms.PlatformOracleImpl
All Implemented Interfaces:
JoinSyntaxTypes, Platform
Direct Known Subclasses:
PlatformOracle9iImpl, PlatformWLOracle9iImpl

public class PlatformOracleImpl
extends PlatformDefaultImpl

This class is a concrete implementation of Platform. Provides an implementation that works around some issues with Oracle in general and Oracle's Thin driver in particular.

Many of the database sequence specific properties can be specified using custom attributes within the sequence-manager element.
The database sequence specific properties are generally speaking, see database user guide for detailed description.

Implementation configuration properties:

Property Key Property Values
sequenceStart DEPRECATED. Database sequence specific property.
Specifies the first sequence number to be generated. Allowed: 1 or greater.
seq.start Database sequence specific property.
Specifies the first sequence number to be generated. Allowed: 1 or greater.
seq.incrementBy Database sequence specific property.
Specifies the interval between sequence numbers. This value can be any positive or negative integer, but it cannot be 0.
seq.maxValue Database sequence specific property.
Set max value for sequence numbers.
seq.minValue Database sequence specific property.
Set min value for sequence numbers.
seq.cycle Database sequence specific property.
If true, specifies that the sequence continues to generate values after reaching either its maximum or minimum value.
If false, specifies that the sequence cannot generate more values after reaching its maximum or minimum value.
seq.cache Database sequence specific property.
Specifies how many values of the sequence Oracle preallocates and keeps in memory for faster access. Allowed values: 2 or greater. If set 0, an explicite nocache expression will be set.
seq.order Database sequence specific property.
If set true, guarantees that sequence numbers are generated in order of request.
If false, a no order expression will be set.

Version:
$Id: PlatformOracleImpl.java,v 1.1 2007-08-24 22:17:35 ewestfal Exp $
Author:
Thomas Mahler

Field Summary
protected static int ORACLE_JDBC_TYPE_CURSOR
          Field value of oracle.jdbc.OracleTypes.CURSOR.
protected static int THIN_BLOB_MAX_SIZE
           
protected static int THIN_CLOB_MAX_SIZE
           
protected static String THIN_URL_PREFIX
           
 
Fields inherited from class org.apache.ojb.broker.platforms.PlatformDefaultImpl
log, m_batchUpdatesChecked, m_supportsBatchUpdates
 
Fields inherited from interface org.apache.ojb.broker.accesslayer.JoinSyntaxTypes
ORACLE_JOIN_SYNTAX, SQL92_JOIN_SYNTAX, SQL92_NOPAREN_JOIN_SYNTAX, SYBASE_JOIN_SYNTAX
 
Constructor Summary
PlatformOracleImpl()
          Default constructor.
 
Method Summary
 void afterStatementCreate(Statement stmt)
          In Oracle we set escape processing explizit 'true' after a statement was created.
protected  void changePreparedStatementResultSetType(PreparedStatement ps)
          Attempts to modify a private member in the Oracle thin driver's resultset to allow proper setting of large binary streams.
 String createSequenceQuery(String sequenceName)
          Override this method to enable database based sequence generation
 String createSequenceQuery(String sequenceName, Properties prop)
          Returns a query to create a sequence entry.
 String dropSequenceQuery(String sequenceName)
          Override this method to enable database based sequence generation
 byte getJoinSyntaxType()
          Get join syntax type for this RDBMS - one on of the constants from JoinSyntaxType interface
protected  void initOracleReflectedVars()
          Initializes static variables needed for getting Oracle-specific JDBC types.
protected static boolean isUsingOracleThinDriver(Connection conn)
          Checks if the supplied connection is using the Oracle thin driver.
 String nextSequenceQuery(String sequenceName)
          Override this method to enable database based sequence generation
 CallableStatement prepareNextValProcedureStatement(Connection con, String procedureName, String sequenceName)
          Method prepareNextValProcedureStatement implementation is simply copied over from PlatformMsSQLServerImpl class.
 void registerOutResultSet(CallableStatement stmt, int position)
          Registers call argument at position as returning a ResultSet value.
 void setObjectForStatement(PreparedStatement ps, int index, Object value, int sqlType)
          For objects beyond 4k, weird things happen in Oracle if you try to use "setBytes", so for all cases it's better to use setBinaryStream.
 
Methods inherited from class org.apache.ojb.broker.platforms.PlatformDefaultImpl
addBatch, addPagingSql, afterStatementClose, beforeBatch, beforeStatementClose, bindPagingParameters, bindPagingParametersFirst, changeAutoCommitState, checkForBatchSupport, concatenate, executeBatch, getConcatenationCharacter, getEscapeClause, getLastInsertIdentityQuery, initializeJdbcConnection, setNullForStatement, supportsBatchOperations, supportsMultiColumnCountDistinct, supportsPaging, useCountForResultsetSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

THIN_URL_PREFIX

protected static final String THIN_URL_PREFIX
See Also:
Constant Field Values

THIN_BLOB_MAX_SIZE

protected static final int THIN_BLOB_MAX_SIZE
See Also:
Constant Field Values

THIN_CLOB_MAX_SIZE

protected static final int THIN_CLOB_MAX_SIZE
See Also:
Constant Field Values

ORACLE_JDBC_TYPE_CURSOR

protected static int ORACLE_JDBC_TYPE_CURSOR
Field value of oracle.jdbc.OracleTypes.CURSOR.

See Also:
initOracleReflectedVars()
Constructor Detail

PlatformOracleImpl

public PlatformOracleImpl()
Default constructor.

Method Detail

prepareNextValProcedureStatement

public CallableStatement prepareNextValProcedureStatement(Connection con,
                                                          String procedureName,
                                                          String sequenceName)
                                                   throws PlatformException
Method prepareNextValProcedureStatement implementation is simply copied over from PlatformMsSQLServerImpl class.

Specified by:
prepareNextValProcedureStatement in interface Platform
Overrides:
prepareNextValProcedureStatement in class PlatformDefaultImpl
Throws:
PlatformException
See Also:
Platform.prepareNextValProcedureStatement(java.sql.Connection, java.lang.String, java.lang.String)

afterStatementCreate

public void afterStatementCreate(Statement stmt)
                          throws PlatformException
In Oracle we set escape processing explizit 'true' after a statement was created.

Specified by:
afterStatementCreate in interface Platform
Overrides:
afterStatementCreate in class PlatformDefaultImpl
Throws:
PlatformException

setObjectForStatement

public void setObjectForStatement(PreparedStatement ps,
                                  int index,
                                  Object value,
                                  int sqlType)
                           throws SQLException
For objects beyond 4k, weird things happen in Oracle if you try to use "setBytes", so for all cases it's better to use setBinaryStream. Oracle also requires a change in the resultset type of the prepared statement. MBAIRD NOTE: BLOBS may not work with Oracle database/thin driver versions prior to 8.1.6.

Specified by:
setObjectForStatement in interface Platform
Overrides:
setObjectForStatement in class PlatformDefaultImpl
Throws:
SQLException
See Also:
Platform.setObjectForStatement(java.sql.PreparedStatement, int, java.lang.Object, int)

changePreparedStatementResultSetType

protected void changePreparedStatementResultSetType(PreparedStatement ps)
Attempts to modify a private member in the Oracle thin driver's resultset to allow proper setting of large binary streams.


getJoinSyntaxType

public byte getJoinSyntaxType()
Get join syntax type for this RDBMS - one on of the constants from JoinSyntaxType interface

Specified by:
getJoinSyntaxType in interface Platform
Overrides:
getJoinSyntaxType in class PlatformDefaultImpl
See Also:
Platform.getJoinSyntaxType()

createSequenceQuery

public String createSequenceQuery(String sequenceName)
Description copied from class: PlatformDefaultImpl
Override this method to enable database based sequence generation

Specified by:
createSequenceQuery in interface Platform
Overrides:
createSequenceQuery in class PlatformDefaultImpl
Parameters:
sequenceName - The name of the sequence to create.
Returns:
a sql string to create a sequence

createSequenceQuery

public String createSequenceQuery(String sequenceName,
                                  Properties prop)
Description copied from interface: Platform
Returns a query to create a sequence entry.

Specified by:
createSequenceQuery in interface Platform
Overrides:
createSequenceQuery in class PlatformDefaultImpl
Parameters:
sequenceName - The name of the sequence to create.
prop - The database specific sequence properties.
Returns:
a sql string to create a sequence

nextSequenceQuery

public String nextSequenceQuery(String sequenceName)
Description copied from class: PlatformDefaultImpl
Override this method to enable database based sequence generation

Specified by:
nextSequenceQuery in interface Platform
Overrides:
nextSequenceQuery in class PlatformDefaultImpl
Returns:
a sql string to get next sequence value

dropSequenceQuery

public String dropSequenceQuery(String sequenceName)
Description copied from class: PlatformDefaultImpl
Override this method to enable database based sequence generation

Specified by:
dropSequenceQuery in interface Platform
Overrides:
dropSequenceQuery in class PlatformDefaultImpl
Returns:
a sql string to drop a sequence

registerOutResultSet

public void registerOutResultSet(CallableStatement stmt,
                                 int position)
                          throws SQLException
Description copied from interface: Platform
Registers call argument at position as returning a ResultSet value.

Specified by:
registerOutResultSet in interface Platform
Overrides:
registerOutResultSet in class PlatformDefaultImpl
Parameters:
stmt - the statement
position - argument position
Throws:
SQLException
See Also:
Platform.registerOutResultSet(java.sql.CallableStatement, int)

isUsingOracleThinDriver

protected static boolean isUsingOracleThinDriver(Connection conn)
Checks if the supplied connection is using the Oracle thin driver.

Parameters:
conn - database connection for which to check JDBC-driver
Returns:
true if the connection is using Oracle thin driver, false otherwise.

initOracleReflectedVars

protected void initOracleReflectedVars()
Initializes static variables needed for getting Oracle-specific JDBC types.



Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.