|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.pds.SQLDatabasePds
This abstract class provides standard SQL database persistent data services.
A concrete subclass must be supplied for each SQL DBMS supported.
Supported API: false
Extendable: false
Field Summary | |
private AttributeMapInfo |
attributeMapInfo
|
private static String |
CLASSNAME
|
protected static DMLGenerator |
DMLGENERATOR
|
private LobHandler |
lobHandler
|
private static String |
LOCATOR_TYPE
|
private static Hashtable |
mapCacheLobOnly
|
private static int |
ORACLE_TYPES_8_0_BLOB
|
private static ThreadLocal |
REFRESH_QUERY_CACHE
|
private static String |
RESOURCE
|
Constructor Summary | |
SQLDatabasePds()
Constructs an instance. |
Method Summary | |
private void |
assignPersistInfo(Persistable a_obj,
ObjectIdentifier a_oid,
Timestamp a_createStamp,
Timestamp a_updateStamp,
Timestamp a_modifyStamp)
|
protected Map |
buildLobMap(ClassInfo aClassInfo)
|
private UpdateBatchSpec |
buildNullForeignKeyBatchSpec(AbstractBatchSpec a_batchSpec,
LinkInfo linkInfo)
|
private int |
buildPartialUpdate(ClassInfo classInfo,
String attrName,
ClassInfo attrClassInfo,
boolean isRequired,
StringBuffer upstmt,
Persistable anObj)
|
private WTPreparedStatement |
buildPreparedStatement(PreparedStatement a_statement,
Map a_map)
|
void |
closeConnection(WTConnection a_connection)
This method is used to clean up the specfied WTConnection prior to freeing the underlying JDBC connection. |
boolean |
containSequenceColumn(ClassInfo a_classInfo)
Supported API: false |
int |
execute(WTConnection a_connection,
AbstractBatchSpec a_batchSpec)
Executes the specified statements in the datastore. |
private int |
execute(WTConnection a_connection,
String[] a_sqls,
Object a_updateBindParameters,
Object a_whereBindParameters,
boolean a_isUpdate,
boolean a_setCurrentTime,
int a_chunkCount)
Executes the specified multi-row statement in the datastore. |
Object |
executeCall(WTConnection a_connection,
String a_procedureName,
StatementParameter[] a_argumentValues,
StatementParameter a_outputType)
This method executes a call to a database stored procedure. |
QueryResult |
expand(WTConnection a_connection,
Persistable a_obj,
String a_otherSideRole,
Class a_linkClass,
boolean a_onlyOtherSide,
AccessControllerProcessor a_accessControllerProcessor)
Expand the association from the object using the specified role and link class. |
QueryResult |
expand(WTConnection a_connection,
Persistable a_obj,
String a_otherSideRole,
QuerySpec a_querySpec,
boolean a_onlyOtherSide,
AccessControllerProcessor a_accessControllerProcessor)
Expand the association from the object using the specified role and QuerySpec. |
private QueryResult |
expandLink(WTConnection a_connection,
Persistable a_obj,
String a_otherSideRole,
boolean a_onlyOtherSide,
QuerySpec a_querySpec,
LinkInfo a_linkInfo,
AccessControllerProcessor a_accessControllerProcessor)
Performs the expand operation. |
AttributeMapInfo |
getAttributeMapInfo()
|
abstract DataSource |
getDataSource()
Supported API: false |
int |
getDefaultTransactionIsolation()
Returns the default Transaction Isolation. |
DMLGenerator |
getDMLGenerator()
Supported API: false |
InputStream |
getLob(WTConnection a_connection,
LobLocator a_lobLocator)
Gets the data from the specified LOB as an InputStream. |
byte[] |
getLobAsByteArray(WTConnection a_connection,
Object a_blob)
Gets the Lob as a byte array. |
Object |
getLobAsObject(WTConnection a_connection,
Object a_blob)
Gets the Lob as an object. |
abstract String |
getNextSequence(WTConnection a_connection,
String a_sequenceName)
Return the next value from the datastore sequence. |
PersistenceException |
handleException(Exception a_exception)
Handles an exception specific to the PDS instance. |
PersistenceException |
handleSQLException(SQLException a_sqlException,
Object a_obj,
String a_messageKey)
Handles an SQL exception specific to the Datastore instance. |
void |
initializeConnection(WTConnection a_connection)
This method is used to initialize the specfied WTConnection prior to making it available to use. |
void |
insert(WTConnection a_connection,
Object a_obj,
boolean a_reInsert)
Insert an object into the SQL database Supported API: false |
private void |
insertList(WTConnection a_connection,
PersistableList a_list,
boolean a_reInsert)
|
int |
insertPageResults(WTConnection a_connection,
int a_offset,
int a_toIndex,
long a_sessionId,
List a_oidList,
int a_groupFromIndex)
Inserts results into the paging table of the datastore. |
boolean |
isLob(ColumnDescriptor a_columnDescriptor)
Indicates if this is a LOB column Supported API: false |
boolean |
isLobLocator(ColumnDescriptor a_columnDescriptor)
Indicates if this is a LobLocator column. |
private boolean |
isMappedLob(ColumnDescriptor aD)
|
protected boolean |
isPersistent(Persistable obj)
|
abstract void |
lock(WTConnection a_connection,
Object a_class,
boolean a_wait)
Perform a datastore lock on an Class table. |
abstract Persistable |
lock(WTConnection a_connection,
Persistable a_obj,
boolean a_wait)
Perform a datastore lock on an Object. |
private void |
nullForeignKey(BinaryLink anObj,
LinkInfo linkInfo)
|
protected PersistenceException |
processSQLException(SQLException a_sqlException,
Object a_obj,
String a_operation,
String a_sqlStatement)
Handles an SQL exception specific to the Datastore instance. |
void |
query(WTConnection a_connection,
StatementSpec a_statementSpec,
AccessControllerProcessor a_accessControllerProcessor,
ResultProcessor a_resultProcessor)
Query for objects in the SQL database. |
Persistable |
refresh(WTConnection a_connection,
Persistable a_obj,
boolean a_inPlace,
AccessControllerProcessor a_accessControllerProcessor)
Refresh the object from the SQL database. |
Persistable |
refresh(WTConnection a_connection,
Persistable a_obj,
boolean a_inPlace,
AccessControllerProcessor a_accessControllerProcessor,
boolean a_lock)
Lock and Refresh the object from the datastore. |
void |
remove(WTConnection a_connection,
Persistable a_obj)
Remove an object from the SQL database. |
private void |
setForeignKey(BinaryLink anObj,
LinkInfo linkInfo)
|
long |
setLob(WTConnection a_connection,
LobLocator a_lobLocator,
InputStream a_inputStream,
boolean a_updateChangeStamp)
Set the data in the InputStream to the specified LOB. |
void |
setLob(WTConnection a_connection,
LobLocator a_lobLocator,
InputStream a_inputStream,
long a_length,
boolean a_updateChangeStamp)
Set the data in the InputStream to the specified LOB. |
void |
setObjectAsLob(WTConnection a_connection,
LobLocator a_lobLocator,
Object a_object)
Set the object as LOB. |
void |
update(WTConnection a_connection,
Object a_obj,
boolean a_changeModifyDate)
Update an object in the SQL database. |
Persistable |
update(WTConnection a_connection,
Persistable a_obj,
String a_attributeName,
ObjectMappable a_attribute)
Update an attribute of an object in the SQL database (partial update). |
private void |
updateList(WTConnection a_connection,
PersistableList a_list,
boolean a_changeModifyDate)
|
protected void |
validateExists(Persistable anObj)
|
protected void |
validateInsert(Persistable anObj,
boolean a_reInsert)
|
private void |
writeToInsertStatement(WTPreparedStatement a_statement,
Persistable a_obj,
ClassInfo a_classInfo,
Timestamp a_createStamp,
Timestamp a_updateStamp,
Timestamp a_modifyStamp,
long a_objectId,
int a_persistInfoOffset)
|
private void |
writeToUpdateStatement(WTPreparedStatement a_statement,
Persistable a_obj,
ClassInfo a_classInfo,
Timestamp a_updateStamp,
Timestamp a_modifyStamp,
int a_updateCount,
long a_objectId,
int a_persistInfoOffset)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final String RESOURCE
private static final String CLASSNAME
private AttributeMapInfo attributeMapInfo
private LobHandler lobHandler
private static final String LOCATOR_TYPE
private static Hashtable mapCacheLobOnly
private static final int ORACLE_TYPES_8_0_BLOB
private static final ThreadLocal REFRESH_QUERY_CACHE
protected static final DMLGenerator DMLGENERATOR
Constructor Detail |
public SQLDatabasePds()
Method Detail |
public void insert(WTConnection a_connection, Object a_obj, boolean a_reInsert) throws PersistenceException
insert
in interface PDSIfc
a_connection
- a_obj
- The object(s) to insert. The value can be either a Persisteable or Persistable[].a_reInsert
-
PersistenceException
public void remove(WTConnection a_connection, Persistable a_obj) throws PersistenceException
remove
in interface PDSIfc
a_connection
- a_obj
-
PersistenceException
public void update(WTConnection a_connection, Object a_obj, boolean a_changeModifyDate) throws PersistenceException
update
in interface PDSIfc
a_connection
- a_obj
- The object(s) to insert. The value can be either a Persisteable or Persistable[].a_changeModifyDate
-
PersistenceException
public Persistable update(WTConnection a_connection, Persistable a_obj, String a_attributeName, ObjectMappable a_attribute) throws PersistenceException
update
in interface PDSIfc
a_connection
- a_obj
- a_attributeName
- a_attribute
-
PersistenceException
public QueryResult expand(WTConnection a_connection, Persistable a_obj, String a_otherSideRole, Class a_linkClass, boolean a_onlyOtherSide, AccessControllerProcessor a_accessControllerProcessor) throws PersistenceException
expand
in interface PDSIfc
a_connection
- a_obj
- a_otherSideRole
- a_linkClass
- a_onlyOtherSide
- a_accessControllerProcessor
-
PersistenceException
public QueryResult expand(WTConnection a_connection, Persistable a_obj, String a_otherSideRole, QuerySpec a_querySpec, boolean a_onlyOtherSide, AccessControllerProcessor a_accessControllerProcessor) throws PersistenceException
expand
in interface PDSIfc
a_connection
- a_obj
- a_otherSideRole
- a_querySpec
- a_onlyOtherSide
- a_accessControllerProcessor
-
PersistenceException
public void query(WTConnection a_connection, StatementSpec a_statementSpec, AccessControllerProcessor a_accessControllerProcessor, ResultProcessor a_resultProcessor) throws PersistenceException
query
in interface PDSIfc
a_connection
- a_statementSpec
- a_accessControllerProcessor
- a_resultProcessor
-
PersistenceException
public Persistable refresh(WTConnection a_connection, Persistable a_obj, boolean a_inPlace, AccessControllerProcessor a_accessControllerProcessor) throws PersistenceException
refresh
in interface PDSIfc
a_connection
- a_obj
- a_inPlace
- a_accessControllerProcessor
-
PersistenceException
public boolean isLob(ColumnDescriptor a_columnDescriptor)
isLob
in interface PDSIfc
a_columnDescriptor
-
public PersistenceException handleException(Exception a_exception)
handleException
in interface PDSIfc
a_exception
-
public PersistenceException handleSQLException(SQLException a_sqlException, Object a_obj, String a_messageKey)
a_sqlException
- a_obj
- a_messageKey
-
public abstract Persistable lock(WTConnection a_connection, Persistable a_obj, boolean a_wait) throws PersistenceException
lock
in interface PDSIfc
a_connection
- a_obj
- a_wait
-
PersistenceException
public abstract String getNextSequence(WTConnection a_connection, String a_sequenceName) throws PersistenceException
getNextSequence
in interface PDSIfc
a_connection
- a_sequenceName
-
PersistenceException
public int getDefaultTransactionIsolation()
getDefaultTransactionIsolation
in interface PDSIfc
public void setLob(WTConnection a_connection, LobLocator a_lobLocator, InputStream a_inputStream, long a_length, boolean a_updateChangeStamp) throws PersistenceException
setLob
in interface PDSIfc
a_connection
- a_lobLocator
- a_inputStream
- a_length
- a_updateChangeStamp
-
PersistenceException
public long setLob(WTConnection a_connection, LobLocator a_lobLocator, InputStream a_inputStream, boolean a_updateChangeStamp) throws PersistenceException
setLob
in interface PDSIfc
a_connection
- a_lobLocator
- a_inputStream
- a_updateChangeStamp
-
PersistenceException
public void setObjectAsLob(WTConnection a_connection, LobLocator a_lobLocator, Object a_object) throws PersistenceException
setObjectAsLob
in interface PDSIfc
a_connection
- a_lobLocator
- a_object
-
PersistenceException
public InputStream getLob(WTConnection a_connection, LobLocator a_lobLocator) throws PersistenceException
getLob
in interface PDSIfc
a_connection
- a_lobLocator
-
PersistenceException
public byte[] getLobAsByteArray(WTConnection a_connection, Object a_blob) throws PersistenceException
getLobAsByteArray
in interface PDSIfc
a_connection
- a_blob
-
PersistenceException
public Object getLobAsObject(WTConnection a_connection, Object a_blob) throws PersistenceException
getLobAsObject
in interface PDSIfc
a_connection
- a_blob
-
PersistenceException
public abstract DataSource getDataSource()
getDataSource
in interface PDSIfc
public DMLGenerator getDMLGenerator()
getDMLGenerator
in interface PDSIfc
public int insertPageResults(WTConnection a_connection, int a_offset, int a_toIndex, long a_sessionId, List a_oidList, int a_groupFromIndex) throws PersistenceException
insertPageResults
in interface PDSIfc
a_connection
- Connection to use to perform the operationa_offset
- a_toIndex
- a_sessionId
- Identification value to use to associate the results with a paging sessiona_oidList
- List of OID values. The elements are assumed to be an Object[]. For every OID, two array entries are assumed. The first is the object ID and the second is the classname.a_groupFromIndex
- Specifies an index into the OID list for grouping. The index is not absolute since each OID uses two array entries. For example, index 3 would specify the OIDarray entries 5 and 6.
PersistenceException
public Object executeCall(WTConnection a_connection, String a_procedureName, StatementParameter[] a_argumentValues, StatementParameter a_outputType) throws PersistenceException
executeCall
in interface PDSIfc
a_connection
- Connection to use to perform the operationa_procedureName
- Specifies the database stored procedure to execute.a_argumentValues
- Array of input argument valuesa_outputType
- StatementParmeter object used to specify the return value. If null, then the stored procedure is assumed to be a procedure and a null value is returned.
PersistenceException
StatementParameter
public void initializeConnection(WTConnection a_connection) throws WTException
initializeConnection
in interface PDSIfc
a_connection
- Connection to initialize.
WTException
public boolean isLobLocator(ColumnDescriptor a_columnDescriptor)
isLobLocator
in interface PDSIfc
a_columnDescriptor
-
public abstract void lock(WTConnection a_connection, Object a_class, boolean a_wait) throws PersistenceException
lock
in interface PDSIfc
a_connection
- a_class
- a_wait
-
PersistenceException
public boolean containSequenceColumn(ClassInfo a_classInfo) throws PersistenceException
containSequenceColumn
in interface PDSIfc
a_classInfo
-
PersistenceException
public Persistable refresh(WTConnection a_connection, Persistable a_obj, boolean a_inPlace, AccessControllerProcessor a_accessControllerProcessor, boolean a_lock) throws PersistenceException
refresh
in interface PDSIfc
a_connection
- a_obj
- a_inPlace
- a_accessControllerProcessor
- a_lock
-
PersistenceException
public int execute(WTConnection a_connection, AbstractBatchSpec a_batchSpec) throws WTException
execute
in interface PDSIfc
a_connection
- The connection to use for the operation.a_batchSpec
- Specifies the statements to execute.
WTException
public void closeConnection(WTConnection a_connection) throws WTException
closeConnection
in interface PDSIfc
a_connection
- Connection to initialize.
WTException
private int execute(WTConnection a_connection, String[] a_sqls, Object a_updateBindParameters, Object a_whereBindParameters, boolean a_isUpdate, boolean a_setCurrentTime, int a_chunkCount) throws WTException
a_connection
- The connection to use for the operation.a_sqls
- Array of SQL statements to executea_isUpdate
- indicates if this is update (true) or delete (false)
WTException
public AttributeMapInfo getAttributeMapInfo()
private void insertList(WTConnection a_connection, PersistableList a_list, boolean a_reInsert) throws WTException
WTException
private void updateList(WTConnection a_connection, PersistableList a_list, boolean a_changeModifyDate) throws WTException
WTException
private void assignPersistInfo(Persistable a_obj, ObjectIdentifier a_oid, Timestamp a_createStamp, Timestamp a_updateStamp, Timestamp a_modifyStamp) throws WTException
WTException
private void writeToInsertStatement(WTPreparedStatement a_statement, Persistable a_obj, ClassInfo a_classInfo, Timestamp a_createStamp, Timestamp a_updateStamp, Timestamp a_modifyStamp, long a_objectId, int a_persistInfoOffset) throws SQLException, WTException
SQLException
WTException
private void writeToUpdateStatement(WTPreparedStatement a_statement, Persistable a_obj, ClassInfo a_classInfo, Timestamp a_updateStamp, Timestamp a_modifyStamp, int a_updateCount, long a_objectId, int a_persistInfoOffset) throws SQLException, WTException
SQLException
WTException
private WTPreparedStatement buildPreparedStatement(PreparedStatement a_statement, Map a_map)
private QueryResult expandLink(WTConnection a_connection, Persistable a_obj, String a_otherSideRole, boolean a_onlyOtherSide, QuerySpec a_querySpec, LinkInfo a_linkInfo, AccessControllerProcessor a_accessControllerProcessor) throws PersistenceException
PersistenceException
protected void validateInsert(Persistable anObj, boolean a_reInsert) throws PersistenceException
PersistenceException
protected void validateExists(Persistable anObj) throws PersistenceException
PersistenceException
private int buildPartialUpdate(ClassInfo classInfo, String attrName, ClassInfo attrClassInfo, boolean isRequired, StringBuffer upstmt, Persistable anObj) throws PersistenceException
PersistenceException
protected boolean isPersistent(Persistable obj)
protected Map buildLobMap(ClassInfo aClassInfo) throws PersistenceException
PersistenceException
private void setForeignKey(BinaryLink anObj, LinkInfo linkInfo) throws PersistenceException
PersistenceException
private UpdateBatchSpec buildNullForeignKeyBatchSpec(AbstractBatchSpec a_batchSpec, LinkInfo linkInfo) throws WTException
WTException
private void nullForeignKey(BinaryLink anObj, LinkInfo linkInfo)
private boolean isMappedLob(ColumnDescriptor aD)
protected PersistenceException processSQLException(SQLException a_sqlException, Object a_obj, String a_operation, String a_sqlStatement)
a_sqlException
- a_obj
- a_operation
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |