Class SchemaManager
- java.lang.Object
-
- org.eclipse.persistence.tools.schemaframework.SchemaManager
-
- Direct Known Subclasses:
DynamicSchemaManager
public class SchemaManager extends java.lang.ObjectPurpose: Define all user level protocol for development time database manipulation.
Responsibilities:
- Define protocol for schema creation.
- Define any useful testing specific protocol.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleancreateDatabaseSchemasFlag to determine if database schemas should be created during DDL generationprotected java.util.HashSet<java.lang.String>createdDatabaseSchemasprotected java.util.HashSet<java.lang.String>createdDatabaseSchemasOnDatabaseprotected java.io.WritercreateSchemaWriterprotected booleancreateSQLFilesprotected TableCreatordefaultTableCreatorprotected java.util.HashMap<java.lang.String,DatabaseObjectDefinition>dropDatabaseSchemasprotected java.io.WriterdropSchemaWriterstatic booleanFAST_TABLE_CREATORAllow table creator to occur "fast" by just deleting all the rows.static booleanFORCE_DROPAllow replacing of table to force the drop, this may require several passes.protected org.eclipse.persistence.internal.sessions.DatabaseSessionImplsession
-
Constructor Summary
Constructors Constructor Description SchemaManager(org.eclipse.persistence.internal.sessions.DatabaseSessionImpl session)SchemaManager(DatabaseSession session)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidalterSequence(SequenceDefinition sequenceDefinition)Use the definition to alter sequence.voidappendToDDLWriter(java.io.Writer schemaWriter, java.lang.String stringToWrite)voidappendToDDLWriter(java.lang.String stringToWrite)PUBLIC: If the schema manager is writing to a writer, append this string to that writer.voidbuildFieldTypes(TableDefinition tableDef)INTERNAL: builds the field names based on the type read in from the builderprotected SequenceDefinitionbuildSequenceDefinition(Sequence sequence)protected java.util.HashSet<SequenceDefinition>buildSequenceDefinitions()INTERNAL: Build the sequence definitions.booleancheckTableExists(TableDefinition table)Check if the table exists by issuing a query.booleancheckTableExists(TableDefinition table, boolean suppressLogging)Check if the table exists by issuing a query.voidcloseDDLWriter()PUBLIC: Close the schema writer.voidcloseDDLWriter(java.io.Writer schemaWriter)protected voidcollectDatabaseSchemasForDrop(DatabaseObjectDefinition databaseObjectDefinition)INTERNAL: Called when dropping tables.voidcreateConstraints(TableDefinition tableDefinition)Use the table definition to add the constraints to the database, this is normally done in two steps to avoid dependencies.voidcreateDefaultTables(boolean generateFKConstraints)Create the default table schema for the project this session associated with.voidcreateObject(DatabaseObjectDefinition databaseObjectDefinition)Use the definition object to create the schema entity on the database.protected voidcreateOrReplaceSequences(boolean create)Common implementor for createSequence and replaceSequenceprotected voidcreateOrReplaceSequences(boolean createSequenceTables, boolean createSequences)Common implementor for createSequence and replaceSequence, distinguishes between sequence tables and sequence objectsvoidcreateSequences()Create all the receiver's sequences on the database for all of the loaded descriptors.voiddropConstraints(TableDefinition tableDefinition)Use the table definition to drop the constraints from the table, this is normally done in two steps to avoid dependencies.voiddropDatabaseSchemas()INTERNAL: Iterate over the schemas that need to be dropped.voiddropDefaultTables()Create the default table schema for the project this session associated with.voiddropObject(DatabaseObjectDefinition databaseObjectDefinition)Use the definition object to drop the schema entity from the database.protected voiddropSequences()This will drop the database schemas if managing the database schemas.voiddropTable(java.lang.String tableName)Drop (delete) the table named tableName from the database.voidextendDefaultTables(boolean generateFKConstraints)Create or extend the default table schema for the project this session associated with.voidfinalize()INTERNAL: Close the schema writer when the schema manger is garbage collectedvoidgenerateStoredProcedures()PUBLIC: Use this method to generate stored procedures based on the dynamic SQL generated for your mappings and descriptors.voidgenerateStoredProcedures(java.io.Writer writer)PUBLIC: Use this method to generate stored procedures based on the dynamic SQL generated for your mappings and descriptors.voidgenerateStoredProceduresAndAmendmentClass(java.io.Writer writer, java.lang.String fullyQualifiedClassName)PUBLIC: Use this method to generate stored procedures based on the dynamic SQL generated for your mappings and descriptors.voidgenerateStoredProceduresAndAmendmentClass(java.lang.String path, java.lang.String fullyQualifiedClassName)PUBLIC: Use this method to generate stored procedures based on the dynamic SQL generated for your mappings and descriptors.protected org.eclipse.persistence.internal.databaseaccess.DatabaseAccessorgetAccessor()Return the appropriate accessor.java.util.VectorgetAllColumnNames(java.lang.String tableName)Get a description of table columns available in a catalog.java.util.VectorgetAllColumnNames(java.lang.String creatorName, java.lang.String tableName)Get a description of table columns available in a catalog.java.util.VectorgetAllTableNames()Get a description of tables available in a catalog.java.util.VectorgetAllTableNames(java.lang.String creatorName)Get a description of table columns available in a catalog.java.util.VectorgetColumnInfo(java.lang.String catalog, java.lang.String schema, java.lang.String tableName, java.lang.String columnName)Get a description of table columns available in a catalog.protected TableCreatorgetDefaultTableCreator(boolean generateFKConstraints)Construct the default TableCreator.protected java.io.WritergetDropSchemaWriter()org.eclipse.persistence.internal.sessions.AbstractSessiongetSession()java.util.VectorgetTableInfo(java.lang.String catalog, java.lang.String schema, java.lang.String tableName, java.lang.String[] types)Get a description of tables available in a catalog.protected java.io.WritergetWriter(java.lang.String fileName)voidoutputCreateDDLToFile(java.lang.String fileName)voidoutputCreateDDLToWriter(java.io.Writer createWriter)voidoutputDDLToDatabase()PUBLIC: Output all DDL statements directly to the database.voidoutputDDLToFile(java.lang.String fileName)PUBLIC: Output all DDL statements to a file writer specified by the name in the parameter.voidoutputDDLToWriter(java.io.Writer schemaWriter)PUBLIC: Output all DDL statements to a writer specified in the parameter.voidoutputDropDDLToFile(java.lang.String fileName)voidoutputDropDDLToWriter(java.io.Writer dropWriter)protected voidprocessSequenceDefinition(SequenceDefinition definition, boolean createTables, boolean createSequences, boolean replace, java.util.HashSet<java.lang.String> createdTableNames, java.util.HashSet<java.lang.String> droppedTableNames)Method creates database tables/objects.protected voidprocessSequenceDefinitions(boolean createSequenceTables, boolean createSequences, boolean replaceSequences)Common implementor for createSequence and replaceSequence, distinguishes between sequence tables and sequence objectsvoidreplaceDefaultTables()Drop and recreate the default table schema for the project this session associated with.voidreplaceDefaultTables(boolean createSequenceTables, boolean generateFKConstraints)Drop and recreate the default table schema for the project this session associated with.voidreplaceDefaultTables(boolean createSequenceTables, boolean createSequences, boolean generateFKConstraints)Drop and recreate the default table schema for the project this session associated with.voidreplaceObject(DatabaseObjectDefinition databaseDefinition)Use the definition object to drop and recreate the schema entity on the database.voidreplaceSequences()Drop and recreate all the receiver's sequences on the database for all of the loaded descriptors.voidsetCreateDatabaseSchemas(boolean createDatabaseSchemas)INTERNAL: Set to true if database schemas should be built during the DDL generation.voidsetCreateSQLFiles(boolean genFlag)voidsetSession(org.eclipse.persistence.internal.sessions.DatabaseSessionImpl session)protected booleanshouldCreateDatabaseSchema(DatabaseObjectDefinition databaseObjectDefinition, java.util.Set<java.lang.String> createdDatabaseSchemas)INTERNAL: Returns true if a database schema should be created during ddl generation for the given databaseObjectDefinition.booleanshouldWriteToDatabase()PUBLIC: Return true if this SchemaManager should write to the database directly
-
-
-
Field Detail
-
session
protected org.eclipse.persistence.internal.sessions.DatabaseSessionImpl session
-
createSchemaWriter
protected java.io.Writer createSchemaWriter
-
dropSchemaWriter
protected java.io.Writer dropSchemaWriter
-
createSQLFiles
protected boolean createSQLFiles
-
defaultTableCreator
protected TableCreator defaultTableCreator
-
FAST_TABLE_CREATOR
public static boolean FAST_TABLE_CREATOR
Allow table creator to occur "fast" by just deleting all the rows.
-
FORCE_DROP
public static boolean FORCE_DROP
Allow replacing of table to force the drop, this may require several passes.
-
createDatabaseSchemas
protected boolean createDatabaseSchemas
Flag to determine if database schemas should be created during DDL generation
-
createdDatabaseSchemas
protected java.util.HashSet<java.lang.String> createdDatabaseSchemas
-
createdDatabaseSchemasOnDatabase
protected java.util.HashSet<java.lang.String> createdDatabaseSchemasOnDatabase
-
dropDatabaseSchemas
protected java.util.HashMap<java.lang.String,DatabaseObjectDefinition> dropDatabaseSchemas
-
-
Constructor Detail
-
SchemaManager
public SchemaManager(org.eclipse.persistence.internal.sessions.DatabaseSessionImpl session)
-
SchemaManager
public SchemaManager(DatabaseSession session)
-
-
Method Detail
-
getDropSchemaWriter
protected java.io.Writer getDropSchemaWriter()
-
appendToDDLWriter
public void appendToDDLWriter(java.lang.String stringToWrite)
PUBLIC: If the schema manager is writing to a writer, append this string to that writer.
-
appendToDDLWriter
public void appendToDDLWriter(java.io.Writer schemaWriter, java.lang.String stringToWrite)
-
buildFieldTypes
public void buildFieldTypes(TableDefinition tableDef)
INTERNAL: builds the field names based on the type read in from the builder
-
closeDDLWriter
public void closeDDLWriter()
PUBLIC: Close the schema writer.
-
closeDDLWriter
public void closeDDLWriter(java.io.Writer schemaWriter)
-
collectDatabaseSchemasForDrop
protected void collectDatabaseSchemasForDrop(DatabaseObjectDefinition databaseObjectDefinition)
INTERNAL: Called when dropping tables. Will build a map of those schemas (and a table that references it) that should be dropped.
-
createConstraints
public void createConstraints(TableDefinition tableDefinition) throws EclipseLinkException
Use the table definition to add the constraints to the database, this is normally done in two steps to avoid dependencies.- Throws:
EclipseLinkException
-
createObject
public void createObject(DatabaseObjectDefinition databaseObjectDefinition) throws EclipseLinkException
Use the definition object to create the schema entity on the database. This is used for creating tables, views, procedures ... etc ...- Throws:
EclipseLinkException
-
createSequences
public void createSequences() throws EclipseLinkExceptionCreate all the receiver's sequences on the database for all of the loaded descriptors.- Throws:
EclipseLinkException
-
setCreateDatabaseSchemas
public void setCreateDatabaseSchemas(boolean createDatabaseSchemas)
INTERNAL: Set to true if database schemas should be built during the DDL generation.
-
setCreateSQLFiles
public void setCreateSQLFiles(boolean genFlag)
-
replaceSequences
public void replaceSequences() throws EclipseLinkExceptionDrop and recreate all the receiver's sequences on the database for all of the loaded descriptors.- Throws:
EclipseLinkException
-
createOrReplaceSequences
protected void createOrReplaceSequences(boolean create) throws EclipseLinkExceptionCommon implementor for createSequence and replaceSequence- Parameters:
create- - true to create the sequences, false to replace them (dropped then create)- Throws:
EclipseLinkException
-
createOrReplaceSequences
protected void createOrReplaceSequences(boolean createSequenceTables, boolean createSequences) throws EclipseLinkExceptionCommon implementor for createSequence and replaceSequence, distinguishes between sequence tables and sequence objects- Parameters:
createSequenceTables- - true to create the sequences tables, false to replace them (dropped then create)createSequences- - true to create the sequences objects, false to replace them (dropped then create)- Throws:
EclipseLinkException
-
dropSequences
protected void dropSequences()
This will drop the database schemas if managing the database schemas.
-
processSequenceDefinition
protected void processSequenceDefinition(SequenceDefinition definition, boolean createTables, boolean createSequences, boolean replace, java.util.HashSet<java.lang.String> createdTableNames, java.util.HashSet<java.lang.String> droppedTableNames) throws EclipseLinkException
Method creates database tables/objects. If create is true, it will attempt to create the object and silently ignore exceptions. If create is false, it will drop the object ignoring any exceptions, then create it if the replace flag is true (otherwise a drop only).- Parameters:
definition- - the sequence definitioncreateTables- - true if table sequence table definitions should be created.createSequences- - true if the sequence definition should be created, false if it should be dropped.replace- - true if table definitions and sequence definitions should be replaced.- Throws:
EclipseLinkException
-
processSequenceDefinitions
protected void processSequenceDefinitions(boolean createSequenceTables, boolean createSequences, boolean replaceSequences) throws EclipseLinkExceptionCommon implementor for createSequence and replaceSequence, distinguishes between sequence tables and sequence objects- Parameters:
createSequenceTables- - true to create the sequences tables, false to replace them (dropped then create)createSequences- - true to create the sequences objects, false to replace them (dropped then create)replaceSequences- - true to actually replace, false to drop only.- Throws:
EclipseLinkException
-
buildSequenceDefinitions
protected java.util.HashSet<SequenceDefinition> buildSequenceDefinitions()
INTERNAL: Build the sequence definitions.
-
checkTableExists
public boolean checkTableExists(TableDefinition table, boolean suppressLogging)
Check if the table exists by issuing a query.- Parameters:
table- database table meta-datasuppressLogging- whether to suppress logging during query execution- Returns:
- value of
trueif given table exists orfalseotherwise
-
checkTableExists
public boolean checkTableExists(TableDefinition table)
Check if the table exists by issuing a query. Logging is suppressed during query execution.- Parameters:
table- database table meta-data- Returns:
- value of
trueif given table exists orfalseotherwise
-
buildSequenceDefinition
protected SequenceDefinition buildSequenceDefinition(Sequence sequence)
-
dropConstraints
public void dropConstraints(TableDefinition tableDefinition) throws EclipseLinkException
Use the table definition to drop the constraints from the table, this is normally done in two steps to avoid dependencies.- Throws:
EclipseLinkException
-
dropObject
public void dropObject(DatabaseObjectDefinition databaseObjectDefinition) throws EclipseLinkException
Use the definition object to drop the schema entity from the database. This is used for dropping tables, views, procedures ... etc ...- Throws:
EclipseLinkException
-
dropTable
public void dropTable(java.lang.String tableName) throws EclipseLinkExceptionDrop (delete) the table named tableName from the database.- Throws:
EclipseLinkException
-
finalize
public void finalize()
INTERNAL: Close the schema writer when the schema manger is garbage collected- Overrides:
finalizein classjava.lang.Object
-
generateStoredProcedures
public void generateStoredProcedures() throws EclipseLinkExceptionPUBLIC: Use this method to generate stored procedures based on the dynamic SQL generated for your mappings and descriptors. This should be used with caution as it maintenance will be high. Stored procedures may be generated either directly on the database or to a file.- Throws:
EclipseLinkException
-
generateStoredProcedures
public void generateStoredProcedures(java.io.Writer writer) throws EclipseLinkExceptionPUBLIC: Use this method to generate stored procedures based on the dynamic SQL generated for your mappings and descriptors. This should be used with caution as it maintenance will be high. Stored procedures may be generated either directly on the database or to a file.- Throws:
EclipseLinkException
-
generateStoredProceduresAndAmendmentClass
public void generateStoredProceduresAndAmendmentClass(java.io.Writer writer, java.lang.String fullyQualifiedClassName) throws EclipseLinkExceptionPUBLIC: Use this method to generate stored procedures based on the dynamic SQL generated for your mappings and descriptors. This should be used with caution as it maintenance will be high. Stored procedures may be generated either directly on the database or to a file.- Throws:
EclipseLinkException
-
generateStoredProceduresAndAmendmentClass
public void generateStoredProceduresAndAmendmentClass(java.lang.String path, java.lang.String fullyQualifiedClassName) throws EclipseLinkExceptionPUBLIC: Use this method to generate stored procedures based on the dynamic SQL generated for your mappings and descriptors. This should be used with caution as it maintenance will be high. Stored procedures may be generated either directly on the database or to a file.- Throws:
EclipseLinkException
-
getAccessor
protected org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor getAccessor()
Return the appropriate accessor. Assume we are dealing with a JDBC accessor.
-
getAllColumnNames
public java.util.Vector getAllColumnNames(java.lang.String tableName) throws DatabaseExceptionGet a description of table columns available in a catalog.Each column description has the following columns:
- TABLE_CAT String => table catalog (may be null)
- TABLE_SCHEM String => table schema (may be null)
- TABLE_NAME String => table name
- COLUMN_NAME String => column name
- DATA_TYPE short => SQL type from java.sql.Types
- TYPE_NAME String => Data source dependent type name
- COLUMN_SIZE int => column size. For char or date types this is the maximum number of characters, for numeric or decimal types this is precision.
- BUFFER_LENGTH is not used.
- DECIMAL_DIGITS int => the number of fractional digits
- NUM_PREC_RADIX int => Radix (typically either 10 or 2)
- NULLABLE int => is NULL allowed?
- columnNoNulls - might not allow NULL values
- columnNullable - definitely allows NULL values
- columnNullableUnknown - nullability unknown
- REMARKS String => comment describing column (may be null)
- COLUMN_DEF String => default value (may be null)
- SQL_DATA_TYPE int => unused
- SQL_DATETIME_SUB int => unused
- CHAR_OCTET_LENGTH int => for char types the maximum number of bytes in the column
- ORDINAL_POSITION int => index of column in table (starting at 1)
- IS_NULLABLE String => "NO" means column definitely does not allow NULL values; "YES" means the column might allow NULL values. An empty string means nobody knows.
- Parameters:
tableName- a table name pattern- Returns:
- a Vector of Records.
- Throws:
DatabaseException
-
getAllColumnNames
public java.util.Vector getAllColumnNames(java.lang.String creatorName, java.lang.String tableName) throws DatabaseExceptionGet a description of table columns available in a catalog.Each column description has the following columns:
- TABLE_CAT String => table catalog (may be null)
- TABLE_SCHEM String => table schema (may be null)
- TABLE_NAME String => table name
- COLUMN_NAME String => column name
- DATA_TYPE short => SQL type from java.sql.Types
- TYPE_NAME String => Data source dependent type name
- COLUMN_SIZE int => column size. For char or date types this is the maximum number of characters, for numeric or decimal types this is precision.
- BUFFER_LENGTH is not used.
- DECIMAL_DIGITS int => the number of fractional digits
- NUM_PREC_RADIX int => Radix (typically either 10 or 2)
- NULLABLE int => is NULL allowed?
- columnNoNulls - might not allow NULL values
- columnNullable - definitely allows NULL values
- columnNullableUnknown - nullability unknown
- REMARKS String => comment describing column (may be null)
- COLUMN_DEF String => default value (may be null)
- SQL_DATA_TYPE int => unused
- SQL_DATETIME_SUB int => unused
- CHAR_OCTET_LENGTH int => for char types the maximum number of bytes in the column
- ORDINAL_POSITION int => index of column in table (starting at 1)
- IS_NULLABLE String => "NO" means column definitely does not allow NULL values; "YES" means the column might allow NULL values. An empty string means nobody knows.
- Parameters:
creatorName- a schema name pattern; "" retrieves those without a schematableName- a table name pattern- Returns:
- a Vector of Records.
- Throws:
DatabaseException
-
getAllTableNames
public java.util.Vector getAllTableNames() throws DatabaseExceptionGet a description of tables available in a catalog.Each table description has the following columns:
- TABLE_CAT String => table catalog (may be null)
- TABLE_SCHEM String => table schema (may be null)
- TABLE_NAME String => table name
- TABLE_TYPE String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
- REMARKS String => explanatory comment on the table
Note: Some databases may not return information for all tables.
- Returns:
- a Vector of Records.
- Throws:
DatabaseException
-
getAllTableNames
public java.util.Vector getAllTableNames(java.lang.String creatorName) throws DatabaseExceptionGet a description of table columns available in a catalog.Each column description has the following columns:
- TABLE_CAT String => table catalog (may be null)
- TABLE_SCHEM String => table schema (may be null)
- TABLE_NAME String => table name
- COLUMN_NAME String => column name
- DATA_TYPE short => SQL type from java.sql.Types
- TYPE_NAME String => Data source dependent type name
- COLUMN_SIZE int => column size. For char or date types this is the maximum number of characters, for numeric or decimal types this is precision.
- BUFFER_LENGTH is not used.
- DECIMAL_DIGITS int => the number of fractional digits
- NUM_PREC_RADIX int => Radix (typically either 10 or 2)
- NULLABLE int => is NULL allowed?
- columnNoNulls - might not allow NULL values
- columnNullable - definitely allows NULL values
- columnNullableUnknown - nullability unknown
- REMARKS String => comment describing column (may be null)
- COLUMN_DEF String => default value (may be null)
- SQL_DATA_TYPE int => unused
- SQL_DATETIME_SUB int => unused
- CHAR_OCTET_LENGTH int => for char types the maximum number of bytes in the column
- ORDINAL_POSITION int => index of column in table (starting at 1)
- IS_NULLABLE String => "NO" means column definitely does not allow NULL values; "YES" means the column might allow NULL values. An empty string means nobody knows.
- Parameters:
creatorName- a schema name pattern; "" retrieves those without a schema- Returns:
- a Vector of Records.
- Throws:
DatabaseException
-
getColumnInfo
public java.util.Vector getColumnInfo(java.lang.String catalog, java.lang.String schema, java.lang.String tableName, java.lang.String columnName) throws DatabaseExceptionGet a description of table columns available in a catalog.Only column descriptions matching the catalog, schema, table and column name criteria are returned. They are ordered by TABLE_SCHEM, TABLE_NAME and ORDINAL_POSITION.
Each column description has the following columns:
- TABLE_CAT String => table catalog (may be null)
- TABLE_SCHEM String => table schema (may be null)
- TABLE_NAME String => table name
- COLUMN_NAME String => column name
- DATA_TYPE short => SQL type from java.sql.Types
- TYPE_NAME String => Data source dependent type name
- COLUMN_SIZE int => column size. For char or date types this is the maximum number of characters, for numeric or decimal types this is precision.
- BUFFER_LENGTH is not used.
- DECIMAL_DIGITS int => the number of fractional digits
- NUM_PREC_RADIX int => Radix (typically either 10 or 2)
- NULLABLE int => is NULL allowed?
- columnNoNulls - might not allow NULL values
- columnNullable - definitely allows NULL values
- columnNullableUnknown - nullability unknown
- REMARKS String => comment describing column (may be null)
- COLUMN_DEF String => default value (may be null)
- SQL_DATA_TYPE int => unused
- SQL_DATETIME_SUB int => unused
- CHAR_OCTET_LENGTH int => for char types the maximum number of bytes in the column
- ORDINAL_POSITION int => index of column in table (starting at 1)
- IS_NULLABLE String => "NO" means column definitely does not allow NULL values; "YES" means the column might allow NULL values. An empty string means nobody knows.
- Parameters:
catalog- a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteriaschema- a schema name pattern; "" retrieves those without a schematableName- a table name patterncolumnName- a column name pattern- Returns:
- a Vector of Records.
- Throws:
DatabaseException
-
getSession
public org.eclipse.persistence.internal.sessions.AbstractSession getSession()
-
getTableInfo
public java.util.Vector getTableInfo(java.lang.String catalog, java.lang.String schema, java.lang.String tableName, java.lang.String[] types) throws DatabaseExceptionGet a description of tables available in a catalog.Only table descriptions matching the catalog, schema, table name and type criteria are returned. They are ordered by TABLE_TYPE, TABLE_SCHEM and TABLE_NAME.
Each table description has the following columns:
- TABLE_CAT String => table catalog (may be null)
- TABLE_SCHEM String => table schema (may be null)
- TABLE_NAME String => table name
- TABLE_TYPE String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
- REMARKS String => explanatory comment on the table
Note: Some databases may not return information for all tables.
- Parameters:
catalog- a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteriaschema- a schema name pattern; "" retrieves those without a schematableName- a table name patterntypes- a list of table types to include; null returns all types- Returns:
- a Vector of Records.
- Throws:
DatabaseException
-
outputDDLToDatabase
public void outputDDLToDatabase()
PUBLIC: Output all DDL statements directly to the database.
-
outputDDLToFile
public void outputDDLToFile(java.lang.String fileName)
PUBLIC: Output all DDL statements to a file writer specified by the name in the parameter.
-
outputCreateDDLToFile
public void outputCreateDDLToFile(java.lang.String fileName)
-
outputDropDDLToFile
public void outputDropDDLToFile(java.lang.String fileName)
-
getWriter
protected java.io.Writer getWriter(java.lang.String fileName)
-
outputDDLToWriter
public void outputDDLToWriter(java.io.Writer schemaWriter)
PUBLIC: Output all DDL statements to a writer specified in the parameter.
-
outputCreateDDLToWriter
public void outputCreateDDLToWriter(java.io.Writer createWriter)
-
outputDropDDLToWriter
public void outputDropDDLToWriter(java.io.Writer dropWriter)
-
replaceObject
public void replaceObject(DatabaseObjectDefinition databaseDefinition) throws EclipseLinkException
Use the definition object to drop and recreate the schema entity on the database. This is used for dropping tables, views, procedures ... etc ... This handles and ignore any database error while dropping in case the object did not previously exist.- Throws:
EclipseLinkException
-
getDefaultTableCreator
protected TableCreator getDefaultTableCreator(boolean generateFKConstraints)
Construct the default TableCreator. If the default TableCreator is already created, just returns it.
-
createDefaultTables
public void createDefaultTables(boolean generateFKConstraints)
Create the default table schema for the project this session associated with.
-
dropDatabaseSchemas
public void dropDatabaseSchemas()
INTERNAL: Iterate over the schemas that need to be dropped.
-
dropDefaultTables
public void dropDefaultTables()
Create the default table schema for the project this session associated with.
-
replaceDefaultTables
public void replaceDefaultTables() throws EclipseLinkExceptionDrop and recreate the default table schema for the project this session associated with.- Throws:
EclipseLinkException
-
replaceDefaultTables
public void replaceDefaultTables(boolean createSequenceTables, boolean generateFKConstraints) throws EclipseLinkExceptionDrop and recreate the default table schema for the project this session associated with.- Throws:
EclipseLinkException
-
replaceDefaultTables
public void replaceDefaultTables(boolean createSequenceTables, boolean createSequences, boolean generateFKConstraints) throws EclipseLinkExceptionDrop and recreate the default table schema for the project this session associated with.- Throws:
EclipseLinkException
-
setSession
public void setSession(org.eclipse.persistence.internal.sessions.DatabaseSessionImpl session)
-
shouldCreateDatabaseSchema
protected boolean shouldCreateDatabaseSchema(DatabaseObjectDefinition databaseObjectDefinition, java.util.Set<java.lang.String> createdDatabaseSchemas)
INTERNAL: Returns true if a database schema should be created during ddl generation for the given databaseObjectDefinition.
-
shouldWriteToDatabase
public boolean shouldWriteToDatabase()
PUBLIC: Return true if this SchemaManager should write to the database directly
-
alterSequence
public void alterSequence(SequenceDefinition sequenceDefinition) throws EclipseLinkException
Use the definition to alter sequence.- Throws:
EclipseLinkException
-
extendDefaultTables
public void extendDefaultTables(boolean generateFKConstraints) throws EclipseLinkExceptionCreate or extend the default table schema for the project this session associated with.- Throws:
EclipseLinkException
-
-