org.opensubsystems.patterns.mappeddata.persist.db.db2
Class DB2MappingDatabaseSchema

java.lang.Object
  extended by org.opensubsystems.core.persist.db.DatabaseSchemaImpl
      extended by org.opensubsystems.core.persist.db.ModifiableDatabaseSchemaImpl
          extended by org.opensubsystems.patterns.mappeddata.persist.db.MappingDatabaseSchema
              extended by org.opensubsystems.patterns.mappeddata.persist.db.db2.DB2MappingDatabaseSchema
All Implemented Interfaces:
org.opensubsystems.core.persist.db.DatabaseOperations, org.opensubsystems.core.persist.db.DatabaseSchema, org.opensubsystems.core.persist.db.ModifiableDatabaseSchema

public class DB2MappingDatabaseSchema
extends MappingDatabaseSchema

Database specific operations related to persistence of mapping tables for IBM DB2 database.

Version:
$Id: DB2MappingDatabaseSchema.java,v 1.8 2007/01/07 06:15:34 bastafidli Exp $
Author:
Julian Legeny
Code reviewer:
Miro Halas
Code reviewed:
1.6 2006/08/15 22:14:06 jlegeny

Field Summary
static int MAPPING_CUSTOM_DATA_MAXLENGTH_DB2
          Maximal length of custom data.
 
Fields inherited from class org.opensubsystems.patterns.mappeddata.persist.db.MappingDatabaseSchema
m_schema1, m_schema2, m_strColumnName1, m_strColumnName2, m_strConstraintBody, m_strMapTableName, m_strTableName1, m_strTableName2, MAPPING_CUSTOM_DATA_MAXLENGTH, MAPPING_SCHEMA_COLUMN1, MAPPING_SCHEMA_COLUMN2, MAPPING_SCHEMA_NAME, MAPPING_SCHEMA_VERSION
 
Fields inherited from class org.opensubsystems.core.persist.db.ModifiableDatabaseSchemaImpl
m_mapModifiableTableNames
 
Fields inherited from class org.opensubsystems.core.persist.db.DatabaseSchemaImpl
DATABASE_SCHEMA_PREFIX, DATABASE_SCHEMA_PREFIX_DEFAULT, m_arrDependentSchemas, m_bIsInDomain, m_iSchemaVersion, m_strSchemaName, NL
 
Fields inherited from interface org.opensubsystems.core.persist.db.DatabaseOperations
DBOP_DELETE, DBOP_INSERT, DBOP_SELECT, DBOP_UPDATE
 
Constructor Summary
DB2MappingDatabaseSchema(java.lang.String strMapTableName, java.lang.Class schema1, java.lang.String strTableName1, java.lang.String strColumnName1, java.lang.Class schema2, java.lang.String strTableName2, java.lang.String strColumnName2)
          Full constructor.
 
Method Summary
static java.lang.String constructInsertStoredProc(java.lang.String strUserName, java.lang.String strMapTableName)
          Construt SQL command for stored procedure that process inserting data.
static java.lang.String constructUpdateStoredProc(java.lang.String strUserName, java.lang.String strMapTableName)
          Construt SQL command for stored procedure that process inserting data.
 void create(java.sql.Connection cntDBConnection, java.lang.String strUserName)
          
 MappedData insertMappedData(java.sql.Connection dbConnection, MappedData data)
          Insert MappedData to the database and return the generated values.
 MappedData updateMappedData(java.sql.Connection dbConnection, MappedData data)
          Update MappedData in the database and return the generated values.
 
Methods inherited from class org.opensubsystems.patterns.mappeddata.persist.db.MappingDatabaseSchema
constructConstraintName, constructSQL, geSelectMappingMultipleRecords, geSelectMappingRecords, getColumns, getDatabaseSpecificInstance, getDeleteMappedDataById, getDeleteMappingRecord, getInsertMappingRecord, getSelectMappedDataById, handleInsertMappedDataException, handleUpdateMappedDataException
 
Methods inherited from class org.opensubsystems.core.persist.db.ModifiableDatabaseSchemaImpl
deleteRelatedData, getModifiableTableNames, handleSQLException
 
Methods inherited from class org.opensubsystems.core.persist.db.DatabaseSchemaImpl
getDependentSchemas, getJoinFromWhere, getName, getOwnerColumnNames, getSchemaPrefix, getVersion, isExistingIndex, isInDomain, upgrade, upgradeView
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opensubsystems.core.persist.db.DatabaseSchema
getDependentSchemas, getName, getVersion, isInDomain, upgrade
 

Field Detail

MAPPING_CUSTOM_DATA_MAXLENGTH_DB2

public static final int MAPPING_CUSTOM_DATA_MAXLENGTH_DB2
Maximal length of custom data. There is limitation for IBM DB2 for length of the VARCHAR column type. If we specify value = 4000 there is following error occured: ErrorCode:42727 - No default primary tablespace exists for the new table. Therefore tablespace has to be changed or if we want to use default tablespace value we specify custom data maxlength to value 3500

See Also:
Constant Field Values
Constructor Detail

DB2MappingDatabaseSchema

public DB2MappingDatabaseSchema(java.lang.String strMapTableName,
                                java.lang.Class schema1,
                                java.lang.String strTableName1,
                                java.lang.String strColumnName1,
                                java.lang.Class schema2,
                                java.lang.String strTableName2,
                                java.lang.String strColumnName2)
                         throws org.opensubsystems.core.error.OSSException
Full constructor.

Parameters:
strMapTableName - - table name for mapping table
schema1 - - schema name the table 1 was defined in
strTableName1 - - name of the table 1
strColumnName1 - - name of the column 1
schema2 - - schema name the table 2 was defined in
strTableName2 - - name of the table 2
strColumnName2 - - name of the column 2
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured
Method Detail

create

public void create(java.sql.Connection cntDBConnection,
                   java.lang.String strUserName)
            throws java.sql.SQLException,
                   org.opensubsystems.core.error.OSSException

Specified by:
create in interface org.opensubsystems.core.persist.db.DatabaseSchema
Overrides:
create in class MappingDatabaseSchema
Throws:
java.sql.SQLException
org.opensubsystems.core.error.OSSException

insertMappedData

public MappedData insertMappedData(java.sql.Connection dbConnection,
                                   MappedData data)
                            throws org.opensubsystems.core.error.OSSException
Insert MappedData to the database and return the generated values.

Overrides:
insertMappedData in class MappingDatabaseSchema
Parameters:
dbConnection - - database connection
data - - MappedData to insert
Returns:
MappedData - the same instance updated with generated values
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

updateMappedData

public MappedData updateMappedData(java.sql.Connection dbConnection,
                                   MappedData data)
                            throws org.opensubsystems.core.error.OSSException
Update MappedData in the database and return the generated values.

Overrides:
updateMappedData in class MappingDatabaseSchema
Parameters:
dbConnection - - database connection
data - - MappedData to update
Returns:
MappedData - the same instance updated with generated values
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

constructInsertStoredProc

public static java.lang.String constructInsertStoredProc(java.lang.String strUserName,
                                                         java.lang.String strMapTableName)
Construt SQL command for stored procedure that process inserting data.

Parameters:
strUserName - - user name
strMapTableName - - table name
Returns:
String - constructed command of insert stored procedure

constructUpdateStoredProc

public static java.lang.String constructUpdateStoredProc(java.lang.String strUserName,
                                                         java.lang.String strMapTableName)
Construt SQL command for stored procedure that process inserting data.

Parameters:
strUserName - - user name
strMapTableName - - table name
Returns:
String - constructed command of insert stored procedure


Copyright © 2003 - 2006 OpenSubsystems s.r.o.