public abstract class TableImpl extends AbstractTable
columns, columnsByName, dba, existsInDatastore, identifier, state, storeMgr, TABLE_STATE_INITIALIZED, TABLE_STATE_INITIALIZED_MODIFIED, TABLE_STATE_NEW, TABLE_STATE_PK_INITIALIZED, TABLE_STATE_VALIDATED
Constructor and Description |
---|
TableImpl(DatastoreIdentifier name,
RDBMSStoreManager storeMgr)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
createConstraints(Connection conn,
Collection autoCreateErrors,
org.datanucleus.ClassLoaderResolver clr)
Method used to create all constraints for a brand new table.
|
void |
dropConstraints(Connection conn)
Method to drop the constraints for the table from the datastore.
|
protected List |
getExpectedCandidateKeys()
Accessor for the expected candidate keys for this table in the datastore.
|
List<ForeignKey> |
getExpectedForeignKeys(org.datanucleus.ClassLoaderResolver clr)
Accessor for the expected foreign keys for this table in the datastore.
|
protected Set |
getExpectedIndices(org.datanucleus.ClassLoaderResolver clr)
Accessor for the indices for this table in the datastore.
|
PrimaryKey |
getPrimaryKey()
Accessor for the primary key for this table.
|
protected Map |
getSQLAddCandidateKeyStatements(Map actualCandidateKeysByName)
Get SQL statements to add expected Candidate Keys that are not yet on the
table.
|
protected Map |
getSQLAddFKStatements(Map actualForeignKeysByName,
org.datanucleus.ClassLoaderResolver clr)
Get SQL statements to add expected Foreign Keys that are not yet at the
table.
|
protected Map |
getSQLCreateIndexStatements(Map actualIndicesByName,
org.datanucleus.ClassLoaderResolver clr)
Accessor for the CREATE INDEX statements for this table.
|
protected List |
getSQLCreateStatements(Properties props)
Accessor for the SQL CREATE statements for this table.
|
protected List |
getSQLDropStatements()
Accessor for the DROP statements for this table.
|
void |
initializeColumnInfoForPrimaryKeyColumns(Connection conn)
Utility to load the structure/metadata of primary key columns of the table.
|
void |
initializeColumnInfoFromDatastore(Connection conn)
Initialize the default value for columns if null using the values from the datastore.
|
protected void |
logMapping(String memberName,
JavaTypeMapping mapping)
Convenience logging method to output the mapping information for an element, key, value field
|
void |
postInitialize(org.datanucleus.ClassLoaderResolver clr)
Post initilize.
|
void |
preInitialize(org.datanucleus.ClassLoaderResolver clr)
Pre-initilize.
|
boolean |
validate(Connection conn,
boolean validateColumnStructure,
boolean autoCreate,
Collection autoCreateErrors)
Method to validate the table in the datastore.
|
boolean |
validateColumns(Connection conn,
boolean validateColumnStructure,
boolean autoCreate,
Collection autoCreateErrors)
Utility to validate the columns of the table.
|
boolean |
validateConstraints(Connection conn,
boolean autoCreate,
Collection autoCreateErrors,
org.datanucleus.ClassLoaderResolver clr)
Method to validate any constraints, and auto create them if required.
|
protected boolean |
validatePrimaryKey(Connection conn)
Utility method to validate the primary key of the table.
|
addColumn, addColumnInternal, allowDDLOutput, assertIsInitialized, assertIsInitializedModified, assertIsPKInitialized, assertIsPKUninitialized, assertIsUninitialized, assertIsValidated, create, drop, equals, executeDdlStatement, executeDdlStatementList, exists, getCatalogName, getClassMetaData, getColumn, getColumnForName, getColumnForPosition, getColumns, getDatastoreIdColumn, getDatastoreIdentifierFullyQualified, getDiscriminatorColumn, getDiscriminatorMapping, getDiscriminatorMetaData, getIdentifier, getMemberColumnMappingForEmbeddedMember, getMemberColumnMappingForMember, getMemberColumnMappings, getMultitenancyColumn, getMultitenancyMapping, getName, getNumberOfColumns, getSchemaName, getStoreManager, getVersionColumn, getVersionMapping, getVersionMetaData, hasColumn, hasColumnName, hashCode, isInitialized, isInitializedModified, isPKInitialized, isValidated, tableExistsInDatastore, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getIdMapping, getMemberMapping, initialize
public TableImpl(DatastoreIdentifier name, RDBMSStoreManager storeMgr)
name
- The name of the table (in SQL).storeMgr
- The StoreManager for this table.public void preInitialize(org.datanucleus.ClassLoaderResolver clr)
clr
- the ClassLoaderResolverpublic void postInitialize(org.datanucleus.ClassLoaderResolver clr)
clr
- the ClassLoaderResolverpublic PrimaryKey getPrimaryKey()
public boolean validate(Connection conn, boolean validateColumnStructure, boolean autoCreate, Collection autoCreateErrors) throws SQLException
conn
- The JDBC ConnectionvalidateColumnStructure
- Whether to validate the column structure, or just the column existenceautoCreate
- Whether to update the table to fix any validation errors. Only applies to missing columns.autoCreateErrors
- Exceptions found in the "auto-create" processSQLException
- Thrown when an error occurs in the JDBC callspublic boolean validateColumns(Connection conn, boolean validateColumnStructure, boolean autoCreate, Collection autoCreateErrors) throws SQLException
conn
- Connection to use for validationvalidateColumnStructure
- Whether to validate down to the structure of the columns, or just their existenceautoCreate
- Whether to auto create any missing columnsautoCreateErrors
- Exceptions found in the "auto-create" processSQLException
- Thrown if an error occurs in the validation processpublic void initializeColumnInfoForPrimaryKeyColumns(Connection conn) throws SQLException
conn
- Connection to use for validationSQLException
- Thrown if an error occurs in the initialization processpublic void initializeColumnInfoFromDatastore(Connection conn) throws SQLException
conn
- The JDBC ConnectionSQLException
- Thrown if an error occurs in the default initialisation.protected boolean validatePrimaryKey(Connection conn) throws SQLException
conn
- Connection to useSQLException
- When an error occurs in the valdiationpublic boolean validateConstraints(Connection conn, boolean autoCreate, Collection autoCreateErrors, org.datanucleus.ClassLoaderResolver clr) throws SQLException
conn
- The JDBC ConnectionautoCreate
- Whether to auto create the constraints if not existingautoCreateErrors
- Errors found in the "auto-create" processclr
- The ClassLoaderResolverSQLException
- Thrown when an error occurs in the JDBC callspublic boolean createConstraints(Connection conn, Collection autoCreateErrors, org.datanucleus.ClassLoaderResolver clr) throws SQLException
conn
- The JDBC ConnectionautoCreateErrors
- Errors found in the "auto-create" processclr
- The ClassLoaderResolverSQLException
- Thrown when an error occurs in the JDBC callspublic void dropConstraints(Connection conn) throws SQLException
conn
- The JDBC ConnectionSQLException
- Thrown when an error occurs in the JDBC call.public List<ForeignKey> getExpectedForeignKeys(org.datanucleus.ClassLoaderResolver clr)
clr
- The ClassLoaderResolverprotected List getExpectedCandidateKeys()
protected Set getExpectedIndices(org.datanucleus.ClassLoaderResolver clr)
clr
- The ClassLoaderResolverprotected List getSQLCreateStatements(Properties props)
getSQLCreateStatements
in class AbstractTable
props
- Properties for controlling the table creationprotected Map getSQLAddFKStatements(Map actualForeignKeysByName, org.datanucleus.ClassLoaderResolver clr)
actualForeignKeysByName
- Actual Map of foreign keysclr
- The ClassLoaderResolverprotected Map getSQLAddCandidateKeyStatements(Map actualCandidateKeysByName)
actualCandidateKeysByName
- Actual Map of candidate keysprotected Map getSQLCreateIndexStatements(Map actualIndicesByName, org.datanucleus.ClassLoaderResolver clr)
actualIndicesByName
- Map of actual indexesclr
- The ClassLoaderResolverprotected List getSQLDropStatements()
getSQLDropStatements
in class AbstractTable
protected void logMapping(String memberName, JavaTypeMapping mapping)
mapping
- The mappingCopyright © 2015. All rights reserved.