|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface Database
Interface to define abstraction for initialization and management of database instance accessed by the application. The main purpose is to define a standard way how to interact with the database, which is used by the application to persist data so that the application can eventually bring the database online or shut it down in case the application runs in embedded environment or environment without DBA babysitting the database. It also define interfaces to access database dependent information such as different SQL functions or statements which can be then used by database schemas.
| Field Summary | |
|---|---|
static int |
BATCH_ITERATOR
Value specifying after how namy iterations the batch will be executed |
static int |
DB2_DATABASE_TYPE
The current database is IBM DB2 |
static java.lang.String |
DB2_DATABASE_TYPE_IDENTIFIER
The current database is IBM DB2 |
static int |
HSQLDB_DATABASE_TYPE
The current database is HSQLDB |
static java.lang.String |
HSQLDB_DATABASE_TYPE_IDENTIFIER
The current database is HSQLDB |
static int |
MAXDB_DATABASE_TYPE
The current database is MaxDB |
static java.lang.String |
MAXDB_DATABASE_TYPE_IDENTIFIER
The current database is MaxDB |
static int |
MSSQL_DATABASE_TYPE
The current database is MSSQL |
static java.lang.String |
MSSQL_DATABASE_TYPE_IDENTIFIER
The current database is MS SQL Server |
static int |
MYSQL_DATABASE_TYPE
The current database is MySQL |
static java.lang.String |
MYSQL_DATABASE_TYPE_IDENTIFIER
The current database is MySQL |
static int |
ORACLE_DATABASE_TYPE
The current database is Oracle |
static java.lang.String |
ORACLE_DATABASE_TYPE_IDENTIFIER
The current database is Oracle |
static int |
POSTGRESQL_DATABASE_TYPE
The current database is PostgreSQL |
static java.lang.String |
POSTGRESQL_DATABASE_TYPE_IDENTIFIER
The current database is PostgreSQL |
static int |
SAPDB_DATABASE_TYPE
The current database is SAP DB |
static java.lang.String |
SAPDB_DATABASE_TYPE_IDENTIFIER
The current database is SAP DB |
static int |
SYBASE_DATABASE_TYPE
The current database is Sybase ASE |
static java.lang.String |
SYBASE_DATABASE_TYPE_IDENTIFIER
The current database is Sybase |
| Method Summary | |
|---|---|
void |
add(java.lang.Class clsSchema)
Add new schema to the database schema by specifying the generic schema class or interface. |
void |
add(DatabaseSchema dsSchema)
Add new schema to the database schema. |
java.lang.String |
getConnectionTestStatement()
Get very efficient parameterless SQL statement which can be used to test connection validity. |
java.lang.String |
getCurrentTimestampFunctionCall()
Get string which can be used in SQL queries to retrieve timestamp representing current time. |
int |
getDatabaseType()
Returns the type of database currently in use. |
java.lang.String |
getDatabaseTypeIdentifier()
Returns the identifier for the type of database currently in use which can be used to construct package and class names. |
int |
getSelectListResultSetConcurrency()
This method returns default result set concurrency which should be used to load lists of items from the result set efficiently. |
int |
getSelectListResultSetType()
This method returns default result set type which should be used to load lists of items from the result set efficiently. |
java.lang.Object[] |
getSQLAnalyzeFunctionCall(java.util.Map mapTableNames)
Get DB specific SQL queries for analyzing tables or updating statistics on the tables (it is good for performance). |
java.lang.String |
getSQLCountFunctionCall()
Get string which can be used in SQL queries to retrieve record count. |
int |
getTransactionIsolation(int iTransactionIsolation)
Different databases have different bugs about what they support so this method will take the desired transaction isolation level and convert it to the one supported by database. |
boolean |
hasAbsolutePositioningSupport()
Find out if database (driver) allows us to call methods such as absolute() or last() for retrieved result sets. |
boolean |
hasSelectListRangeSupport()
Find out if database allows us to support rows limitation. |
void |
insertAndFetchGeneratedValues(java.sql.Connection dbConnection,
java.sql.PreparedStatement insertStatement,
boolean bIsInDomain,
java.lang.String strTableName,
int iIndex,
BasicDataObject data)
Insert the data, fetch from the database id and generated creation and optionally modification timestamps for the newly created data object. |
boolean |
isCallableStatement(java.lang.String strQuery)
Test if the specified query invokes stored procedure or if it is just a regular prepared statement. |
boolean |
isStarted()
Test if the database is started. |
boolean |
preferCountToLast()
Find out if when trying to find out size of the result set we should use rather count(*)/count(1)/count(id) instead of using hasAbsolutePositioningSupport. |
void |
start()
Start the database. |
void |
stop()
Stop the database. |
void |
updatedAndFetchGeneratedValues(java.lang.String strDataName,
java.sql.Connection dbConnection,
java.sql.PreparedStatement updateStatement,
boolean bIsInDomain,
java.lang.String strTableName,
int iIndex,
ModifiableDataObject data)
Update the data, check for errors and fetch from the database generated modification timestamps for the updated data object. |
| Field Detail |
|---|
static final int BATCH_ITERATOR
static final int HSQLDB_DATABASE_TYPE
static final java.lang.String HSQLDB_DATABASE_TYPE_IDENTIFIER
static final int SAPDB_DATABASE_TYPE
static final java.lang.String SAPDB_DATABASE_TYPE_IDENTIFIER
static final int POSTGRESQL_DATABASE_TYPE
static final java.lang.String POSTGRESQL_DATABASE_TYPE_IDENTIFIER
static final int MYSQL_DATABASE_TYPE
static final java.lang.String MYSQL_DATABASE_TYPE_IDENTIFIER
static final int MSSQL_DATABASE_TYPE
static final java.lang.String MSSQL_DATABASE_TYPE_IDENTIFIER
static final int DB2_DATABASE_TYPE
static final java.lang.String DB2_DATABASE_TYPE_IDENTIFIER
static final int SYBASE_DATABASE_TYPE
static final java.lang.String SYBASE_DATABASE_TYPE_IDENTIFIER
static final int ORACLE_DATABASE_TYPE
static final java.lang.String ORACLE_DATABASE_TYPE_IDENTIFIER
static final int MAXDB_DATABASE_TYPE
static final java.lang.String MAXDB_DATABASE_TYPE_IDENTIFIER
| Method Detail |
|---|
void start()
throws OSSException
OSSException - - database cannot be started.
void stop()
throws OSSException
OSSException - - problems stopping the database
void add(DatabaseSchema dsSchema)
throws OSSException
dsSchema - - schema to add to the database
OSSException - - database cannot be started.
void add(java.lang.Class clsSchema)
throws OSSException
clsSchema - - class representing schema to add to the database
OSSException - - database cannot be started.int getDatabaseType()
java.lang.String getDatabaseTypeIdentifier()
boolean isStarted()
java.lang.String getConnectionTestStatement()
int getTransactionIsolation(int iTransactionIsolation)
iTransactionIsolation - - desired transaction isolation level
int getSelectListResultSetType()
int getSelectListResultSetConcurrency()
boolean hasAbsolutePositioningSupport()
boolean preferCountToLast()
java.lang.String getCurrentTimestampFunctionCall()
java.lang.Object[] getSQLAnalyzeFunctionCall(java.util.Map mapTableNames)
mapTableNames - - map of table names the update statistics will be
processed on. Key is the data object data of which
are stored in the table and value is te name of the
table
java.lang.String getSQLCountFunctionCall()
boolean hasSelectListRangeSupport()
boolean isCallableStatement(java.lang.String strQuery)
strQuery - - query to test
void insertAndFetchGeneratedValues(java.sql.Connection dbConnection,
java.sql.PreparedStatement insertStatement,
boolean bIsInDomain,
java.lang.String strTableName,
int iIndex,
BasicDataObject data)
throws java.sql.SQLException,
OSSException
dbConnection - - connection to use to access the databaseinsertStatement - - statement used to insert the data. This can be
CallableStatement if stored procedure is used.bIsInDomain - - are the data objects maintained in domainsstrTableName - - name of the table where the data are being insertediIndex - - 1 based index of the next parameter value of which can be
set on the statement (last parameter set by caller + 1)data - - data object to update with the fetched values
java.sql.SQLException - - an error has occured
OSSException - - an error has occured
void updatedAndFetchGeneratedValues(java.lang.String strDataName,
java.sql.Connection dbConnection,
java.sql.PreparedStatement updateStatement,
boolean bIsInDomain,
java.lang.String strTableName,
int iIndex,
ModifiableDataObject data)
throws java.sql.SQLException,
OSSException
strDataName - - name of the data objectdbConnection - - connection to use to access the datavaseupdateStatement - - statement to update data in the database. This
can be CallableStatement if stored procedure is
used.bIsInDomain - - are the data objects maintained in domainsstrTableName - - name of the tableiIndex - - 1 based index of the next parameter value of which can be
set on the statement (last parameter set by caller + 1)data - - data object to update
java.sql.SQLException - - an error has occured
OSSException - - an error has occured
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||