public final class DirtyTempTableHelper extends TempTableHelper
This class is responsible for global temporary tables support: the created tables and indices will be global and available to all sessions.
Modifier and Type | Field and Description |
---|---|
private static java.util.Map<Database,java.util.Map<java.lang.String,java.util.ArrayList<P2JIndex>>> |
indexCache
Cache with the indexes retrieved from the database, for each table and database.
|
private static java.util.logging.Logger |
LOG
Logger
|
database, schema, UNIQUE_SUFFIX_KEY
Constructor and Description |
---|
DirtyTempTableHelper(P2JDialect dialect,
java.lang.Class<?> dmoIface,
Database database)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
generateSQLCreateIndex(P2JDialect dialect,
P2JIndex index,
org.hibernate.mapping.Table table,
boolean mpid,
boolean overridePK)
Generate the dialect-specific SQL statement used to create an index
for the temp table.
|
protected java.util.List<java.lang.String> |
generateSQLDropIndexList(P2JDialect dialect,
java.lang.Class<?> dmoIface,
org.hibernate.mapping.Table primary,
java.util.List<org.hibernate.mapping.Table> secondaries)
This method is overridden to return an empty list - once created, the
indices can not be dropped.
|
protected java.util.List<java.lang.String> |
generateSQLDropTableList(P2JDialect dialect,
org.hibernate.mapping.Table primary,
java.util.List<org.hibernate.mapping.Table> secondaries)
This method is overridden to return an empty list - once created, the
tables can not be dropped.
|
protected java.lang.String |
getAdditionalIndexSuffix()
This method returns an empty string: the indexes must be global.
|
protected java.util.Map<java.lang.String,P2JIndexComponent> |
getComputedCols(java.lang.String schema,
java.lang.Class<?> dmoIface)
This method will retrieve the computed columns for the required DMO, as
found in the indexes retrieved from the database.
|
protected java.lang.String |
getCreateTableStatement()
This method will return the needed create table string, which is the
"create temporary table" string.
|
protected java.util.Iterator<P2JIndex> |
getIndexes(java.lang.String schema,
java.lang.Class<?> dmoIface)
This method will return the indexes associated with a certain DMO, as
found in the associated database.
|
protected boolean |
isNotNullAllowed()
Indicate whether non-nullable columns are permitted.
|
generateSQLCreateIndexList, generateSQLDropIndex, generateSQLDropIndexList, get, getComputedCols, getTableName, sqlTempTableCreate, sqlTempTableDrop, sqlTempTableIndexCreate, sqlTempTableIndexDrop
DirtyTempTableHelper(P2JDialect dialect, java.lang.Class<?> dmoIface, Database database)
dialect
- Hibernate database dialect helper.dmoIface
- DMO interface which provides the public API to the temp
table.database
- The database for which we generate the sql's.protected java.lang.String getCreateTableStatement()
getCreateTableStatement
in class TempTableHelper
protected java.lang.String getAdditionalIndexSuffix()
getAdditionalIndexSuffix
in class TempTableHelper
protected java.util.List<java.lang.String> generateSQLDropIndexList(P2JDialect dialect, java.lang.Class<?> dmoIface, org.hibernate.mapping.Table primary, java.util.List<org.hibernate.mapping.Table> secondaries)
dialect
- Hibernate database dialect helper.dmoIface
- DMO interface which provides the public API to the temp
table.primary
- Hibernate database table configuration for primary temp
table.secondaries
- Optional list of Hibernate database table configurations
for secondary temp tables. These are the tables which
support temp table fields with extents, if any. May be
null
if no such tables exist.protected java.lang.String generateSQLCreateIndex(P2JDialect dialect, P2JIndex index, org.hibernate.mapping.Table table, boolean mpid, boolean overridePK)
Override the parent's implementation to never add the primary key as the last component of the index.
generateSQLCreateIndex
in class TempTableHelper
dialect
- Hibernate database dialect helper.index
- P2J index descriptor.table
- Hibernate database table helper.mpid
- true
to make multiplex ID the leading index
component; false
to omit it. The multiplex ID
column will not be indexed if the TempTableHelper.schema
is not the
DatabaseManager.TEMP_TABLE_SCHEMA
.overridePK
- If true
, do not add primary key column to a
non-unique index; if false
, add primary key
column to a non-unique index. This method overrides the parent
to ignore this parameter and always pass true
to
the parent's implementation.protected java.util.List<java.lang.String> generateSQLDropTableList(P2JDialect dialect, org.hibernate.mapping.Table primary, java.util.List<org.hibernate.mapping.Table> secondaries)
generateSQLDropTableList
in class TempTableHelper
dialect
- Hibernate database dialect helper.primary
- Hibernate database table configuration for primary temp
table.secondaries
- Optional list of Hibernate database table configurations
for secondary temp tables. These are the tables which
support temp table fields with extents, if any. May be
null
if no such tables exist.protected java.util.Map<java.lang.String,P2JIndexComponent> getComputedCols(java.lang.String schema, java.lang.Class<?> dmoIface)
getComputedCols
in class TempTableHelper
schema
- The schema used for this DMO.dmoIface
- The DMO for which to retrieve the computed columns.protected java.util.Iterator<P2JIndex> getIndexes(java.lang.String schema, java.lang.Class<?> dmoIface)
Once retrieved, the indexes will be kept in a cache
,
for each table, by database.
getIndexes
in class TempTableHelper
schema
- The schema used for this DMO.dmoIface
- The DMO for which to retrieve the indexes.java.lang.RuntimeException
- if there is any error retrieving the index metadata for the given schema and DMO.protected boolean isNotNullAllowed()
isNotNullAllowed
in class TempTableHelper
true
if non-nullable columns are permitted, else false
.