org.apache.ojb.broker.platforms
Class PlatformDb2Impl

java.lang.Object
  extended by org.apache.ojb.broker.platforms.PlatformDefaultImpl
      extended by org.apache.ojb.broker.platforms.PlatformDb2Impl
All Implemented Interfaces:
JoinSyntaxTypes, Platform

public class PlatformDb2Impl
extends PlatformDefaultImpl

This class extends PlatformDefaultImpl and defines specific behavior for the DB2 platform.

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.

Supported properties on sequence creation:

Property Key Property Values
seq.as Database sequence specific property.
Specifies the datatype used for the sequence. Allowed: all numeric datatypes? e.g. INTEGER
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: PlatformDb2Impl.java,v 1.1 2007-08-24 22:17:35 ewestfal Exp $
Author:
Thomas Mahler

Field Summary
 
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
PlatformDb2Impl()
           
 
Method Summary
 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
 String getLastInsertIdentityQuery(String tableName)
          If database supports native key generation via identity column, this method should return the sql-query to obtain the last generated id.
 String nextSequenceQuery(String sequenceName)
          Override this method to enable database based sequence generation
 void setObjectForStatement(PreparedStatement ps, int index, Object value, int sqlType)
          Patch provided by Avril Kotzen (hi001@webmail.co.za) DB2 handles TINYINT (for mapping a byte).
 
Methods inherited from class org.apache.ojb.broker.platforms.PlatformDefaultImpl
addBatch, addPagingSql, afterStatementClose, afterStatementCreate, beforeBatch, beforeStatementClose, bindPagingParameters, bindPagingParametersFirst, changeAutoCommitState, checkForBatchSupport, concatenate, executeBatch, getConcatenationCharacter, getEscapeClause, getJoinSyntaxType, initializeJdbcConnection, prepareNextValProcedureStatement, registerOutResultSet, setNullForStatement, supportsBatchOperations, supportsMultiColumnCountDistinct, supportsPaging, useCountForResultsetSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlatformDb2Impl

public PlatformDb2Impl()
Method Detail

setObjectForStatement

public void setObjectForStatement(PreparedStatement ps,
                                  int index,
                                  Object value,
                                  int sqlType)
                           throws SQLException
Patch provided by Avril Kotzen (hi001@webmail.co.za) DB2 handles TINYINT (for mapping a byte).

Specified by:
setObjectForStatement in interface Platform
Overrides:
setObjectForStatement in class PlatformDefaultImpl
Throws:
SQLException

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

getLastInsertIdentityQuery

public String getLastInsertIdentityQuery(String tableName)
Description copied from interface: Platform
If database supports native key generation via identity column, this method should return the sql-query to obtain the last generated id.

Specified by:
getLastInsertIdentityQuery in interface Platform
Overrides:
getLastInsertIdentityQuery in class PlatformDefaultImpl


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