Top Description Fields Constructors Methods
org.eclipse.persistence.tools.schemaframework

public Class SchemaManager

extends Object
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.tools.schemaframework.DynamicSchemaManager
Imports
java.io.Writer, java.net.URL, java.util.HashMap, .HashSet, .Set, .Vector, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.exceptions.DatabaseException, .EclipseLinkException, .ValidationException, org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor, org.eclipse.persistence.internal.helper.Helper, org.eclipse.persistence.internal.sequencing.Sequencing, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, .DatabaseSessionImpl, org.eclipse.persistence.sequencing.DefaultSequence, .NativeSequence, .Sequence, .TableSequence, .UnaryTableSequence

Purpose: Define all user level protocol for development time database manipulation.

Responsibilities:

Field Summary

Modifier and TypeField and Description
protected boolean
createDatabaseSchemas

Flag to determine if database schemas should be created during DDL generation

protected HashSet<String>
protected HashSet<String>
protected Writer
protected boolean
protected TableCreator
protected HashMap<String, DatabaseObjectDefinition>
protected Writer
public static boolean
FAST_TABLE_CREATOR

Allow table creator to occur "fast" by just deleting all the rows.

public static boolean
FORCE_DROP

Allow replacing of table to force the drop, this may require several passes.

protected DatabaseSessionImpl

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public void
alterSequence(SequenceDefinition sequenceDefinition)

Use the definition to alter sequence.

public void
appendToDDLWriter(String stringToWrite)

PUBLIC: If the schema manager is writing to a writer, append this string to that writer.

public void
appendToDDLWriter(Writer schemaWriter, String stringToWrite)

public void
buildFieldTypes(TableDefinition tableDef)

INTERNAL: builds the field names based on the type read in from the builder

protected SequenceDefinition
protected Set<SequenceDefinition>
buildSequenceDefinitions()

INTERNAL: Build the sequence definitions.

public boolean

Returns:

value of true if given table exists or false otherwise
checkTableExists
(TableDefinition
database table meta-data
table
,
final boolean
whether to suppress logging during query execution
suppressLogging
)

Check if the table exists by issuing a query.

public boolean

Returns:

value of true if given table exists or false otherwise
checkTableExists
(TableDefinition
database table meta-data
table
)

Check if the table exists by issuing a query.

public void
closeDDLWriter()

PUBLIC: Close the schema writer.

public void
closeDDLWriter(Writer schemaWriter)

protected void
collectDatabaseSchemasForDrop(DatabaseObjectDefinition databaseObjectDefinition)

INTERNAL: Called when dropping tables.

public void
createConstraints(TableDefinition tableDefinition)

Use the table definition to add the constraints to the database, this is normally done in two steps to avoid dependencies.

public void
createDefaultTables(boolean generateFKConstraints)

Create the default table schema for the project this session associated with.

pack-priv void
public void
createObject(DatabaseObjectDefinition databaseObjectDefinition)

Use the definition object to create the schema entity on the database.

protected void
createOrReplaceSequences(boolean
- true to create the sequences, false to replace them (dropped then create)
create
)

Common implementor for createSequence and replaceSequence

protected void
createOrReplaceSequences(boolean
- true to create the sequences tables, false to replace them (dropped then create)
createSequenceTables
,
boolean
- true to create the sequences objects, false to replace them (dropped then create)
createSequences
)

Common implementor for createSequence and replaceSequence, distinguishes between sequence tables and sequence objects

public void
createSequences()

Create all the receiver's sequences on the database for all of the loaded descriptors.

pack-priv void
public void
dropConstraints(TableDefinition tableDefinition)

Use the table definition to drop the constraints from the table, this is normally done in two steps to avoid dependencies.

public void
dropDatabaseSchemas()

INTERNAL: Iterate over the schemas that need to be dropped.

public void
dropDefaultTables()

Create the default table schema for the project this session associated with.

public void
dropObject(DatabaseObjectDefinition databaseObjectDefinition)

Use the definition object to drop the schema entity from the database.

protected void
dropSequences()

This will drop the database schemas if managing the database schemas.

public void
dropTable(String tableName)

Drop (delete) the table named tableName from the database.

public void
extendDefaultTables(boolean generateFKConstraints)

Create or extend the default table schema for the project this session associated with.

public void
finalize()

Overrides java.lang.Object.finalize.

INTERNAL: Close the schema writer when the schema manger is garbage collected
public void
generateStoredProcedures()

PUBLIC: Use this method to generate stored procedures based on the dynamic SQL generated for your mappings and descriptors.

public void
generateStoredProcedures(Writer writer)

PUBLIC: Use this method to generate stored procedures based on the dynamic SQL generated for your mappings and descriptors.

public void
generateStoredProceduresAndAmendmentClass(Writer writer, String fullyQualifiedClassName)

PUBLIC: Use this method to generate stored procedures based on the dynamic SQL generated for your mappings and descriptors.

public void
generateStoredProceduresAndAmendmentClass(String path, String fullyQualifiedClassName)

PUBLIC: Use this method to generate stored procedures based on the dynamic SQL generated for your mappings and descriptors.

protected DatabaseAccessor
getAccessor()

Return the appropriate accessor.

public Vector<AbstractRecord>

Returns:

a Vector of Records.
getAllColumnNames
(String
a table name pattern
tableName
)

Get a description of table columns available in a catalog.

public Vector<AbstractRecord>

Returns:

a Vector of Records.
getAllColumnNames
(String
a schema name pattern; "" retrieves those without a schema
creatorName
,
String
a table name pattern
tableName
)

Get a description of table columns available in a catalog.

public Vector<AbstractRecord>

Returns:

a Vector of Records.
getAllTableNames
()

Get a description of tables available in a catalog.

public Vector<AbstractRecord>

Returns:

a Vector of Records.
getAllTableNames
(String
a schema name pattern; "" retrieves those without a schema
creatorName
)

Get a description of table columns available in a catalog.

public Vector<AbstractRecord>

Returns:

a Vector of Records.
getColumnInfo
(String
a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria
catalog
,
String
a schema name pattern; "" retrieves those without a schema
schema
,
String
a table name pattern
tableName
,
String
a column name pattern
columnName
)

Get a description of table columns available in a catalog.

public Vector<AbstractRecord>
getColumnInfo(String tableName, String columnName)

protected TableCreator
getDefaultTableCreator(boolean generateFKConstraints)

Construct the default TableCreator.

protected Writer
public AbstractSession
public Vector<AbstractRecord>

Returns:

a Vector of Records.
getTableInfo
(String
a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria
catalog
,
String
a schema name pattern; "" retrieves those without a schema
schema
,
String
a table name pattern
tableName
,
String[]
a list of table types to include; null returns all types
types
)

Get a description of tables available in a catalog.

protected Writer
getWriter(String fileName)

public void
public void
public void
outputDDLToDatabase()

PUBLIC: Output all DDL statements directly to the database.

public void
outputDDLToFile(String fileName)

PUBLIC: Output all DDL statements to a file writer specified by the name in the parameter.

public void
outputDDLToWriter(Writer schemaWriter)

PUBLIC: Output all DDL statements to a writer specified in the parameter.

public void
public void
protected void
processSequenceDefinition(SequenceDefinition
- the sequence definition
definition
,
final boolean
- true if table sequence table definitions should be created.
createTables
,
final boolean
- true if the sequence definition should be created, false if it should be dropped.
createSequences
,
final boolean
- true if table definitions and sequence definitions should be replaced.
replace
,
Set<String> createdTableNames, Set<String> droppedTableNames)

Method creates database tables/objects.

protected void
processSequenceDefinitions(boolean
- true to create the sequences tables, false to replace them (dropped then create)
createSequenceTables
,
boolean
- true to create the sequences objects, false to replace them (dropped then create)
createSequences
,
boolean
- true to actually replace, false to drop only.
replaceSequences
)

Common implementor for createSequence and replaceSequence, distinguishes between sequence tables and sequence objects

public void
replaceDefaultTables()

Drop and recreate the default table schema for the project this session associated with.

public void
replaceDefaultTables(boolean createSequenceTables, boolean generateFKConstraints)

Drop and recreate the default table schema for the project this session associated with.

public void
replaceDefaultTables(boolean createSequenceTables, boolean createSequences, boolean generateFKConstraints)

Drop and recreate the default table schema for the project this session associated with.

public void
replaceObject(DatabaseObjectDefinition databaseDefinition)

Use the definition object to drop and recreate the schema entity on the database.

public void
replaceSequences()

Drop and recreate all the receiver's sequences on the database for all of the loaded descriptors.

public void
setCreateDatabaseSchemas(boolean createDatabaseSchemas)

INTERNAL: Set to true if database schemas should be built during the DDL generation.

public void
setCreateSQLFiles(boolean genFlag)

public void
protected boolean
shouldCreateDatabaseSchema(DatabaseObjectDefinition databaseObjectDefinition, Set<String> createdDatabaseSchemas)

INTERNAL: Returns true if a database schema should be created during ddl generation for the given databaseObjectDefinition.

public boolean
shouldWriteToDatabase()

PUBLIC: Return true if this SchemaManager should write to the database directly

Inherited from java.lang.Object:
cloneequalsgetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

createDatabaseSchemasback to summary
protected boolean createDatabaseSchemas

Flag to determine if database schemas should be created during DDL generation

createdDatabaseSchemasback to summary
protected HashSet<String> createdDatabaseSchemas
createdDatabaseSchemasOnDatabaseback to summary
protected HashSet<String> createdDatabaseSchemasOnDatabase
createSchemaWriterback to summary
protected Writer createSchemaWriter
createSQLFilesback to summary
protected boolean createSQLFiles
defaultTableCreatorback to summary
protected TableCreator defaultTableCreator
dropDatabaseSchemasback to summary
protected HashMap<String, DatabaseObjectDefinition> dropDatabaseSchemas
dropSchemaWriterback to summary
protected Writer dropSchemaWriter
FAST_TABLE_CREATORback to summary
public static boolean FAST_TABLE_CREATOR

Allow table creator to occur "fast" by just deleting all the rows.

FORCE_DROPback to summary
public static boolean FORCE_DROP

Allow replacing of table to force the drop, this may require several passes.

sessionback to summary
protected DatabaseSessionImpl session

Constructor Detail

SchemaManagerback to summary
public SchemaManager(DatabaseSessionImpl session)
SchemaManagerback to summary
public SchemaManager(DatabaseSession session)

Method Detail

alterSequenceback to summary
public void alterSequence(SequenceDefinition sequenceDefinition) throws EclipseLinkException

Use the definition to alter sequence.

appendToDDLWriterback to summary
public void appendToDDLWriter(String stringToWrite)

PUBLIC: If the schema manager is writing to a writer, append this string to that writer.

appendToDDLWriterback to summary
public void appendToDDLWriter(Writer schemaWriter, String stringToWrite)
buildFieldTypesback to summary
public void buildFieldTypes(TableDefinition tableDef)

INTERNAL: builds the field names based on the type read in from the builder

buildSequenceDefinitionback to summary
protected SequenceDefinition buildSequenceDefinition(Sequence sequence)
buildSequenceDefinitionsback to summary
protected Set<SequenceDefinition> buildSequenceDefinitions()

INTERNAL: Build the sequence definitions.

checkTableExistsback to summary
public boolean checkTableExists(TableDefinition table, final boolean suppressLogging)

Check if the table exists by issuing a query.

Parameters
table:TableDefinition

database table meta-data

suppressLogging:boolean

whether to suppress logging during query execution

Returns:boolean

value of true if given table exists or false otherwise

checkTableExistsback to summary
public boolean checkTableExists(TableDefinition table)

Check if the table exists by issuing a query. Logging is suppressed during query execution.

Parameters
table:TableDefinition

database table meta-data

Returns:boolean

value of true if given table exists or false otherwise

closeDDLWriterback to summary
public void closeDDLWriter()

PUBLIC: Close the schema writer.

closeDDLWriterback to summary
public void closeDDLWriter(Writer schemaWriter)
collectDatabaseSchemasForDropback to summary
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.

createConstraintsback to summary
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.

createDefaultTablesback to summary
public void createDefaultTables(boolean generateFKConstraints)

Create the default table schema for the project this session associated with.

createForeignConstraintsback to summary
pack-priv void createForeignConstraints(TableDefinition tableDefinition) throws EclipseLinkException
createObjectback to summary
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 ...

createOrReplaceSequencesback to summary
protected void createOrReplaceSequences(boolean create) throws EclipseLinkException

Common implementor for createSequence and replaceSequence

Parameters
create:boolean

- true to create the sequences, false to replace them (dropped then create)

createOrReplaceSequencesback to summary
protected void createOrReplaceSequences(boolean createSequenceTables, boolean createSequences) throws EclipseLinkException

Common implementor for createSequence and replaceSequence, distinguishes between sequence tables and sequence objects

Parameters
createSequenceTables:boolean

- true to create the sequences tables, false to replace them (dropped then create)

createSequences:boolean

- true to create the sequences objects, false to replace them (dropped then create)

createSequencesback to summary
public void createSequences() throws EclipseLinkException

Create all the receiver's sequences on the database for all of the loaded descriptors.

createUniqueConstraintsback to summary
pack-priv void createUniqueConstraints(TableDefinition tableDefinition) throws EclipseLinkException
dropConstraintsback to summary
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.

dropDatabaseSchemasback to summary
public void dropDatabaseSchemas()

INTERNAL: Iterate over the schemas that need to be dropped.

dropDefaultTablesback to summary
public void dropDefaultTables()

Create the default table schema for the project this session associated with.

dropObjectback to summary
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 ...

dropSequencesback to summary
protected void dropSequences()

This will drop the database schemas if managing the database schemas.

dropTableback to summary
public void dropTable(String tableName) throws EclipseLinkException

Drop (delete) the table named tableName from the database.

extendDefaultTablesback to summary
public void extendDefaultTables(boolean generateFKConstraints) throws EclipseLinkException

Create or extend the default table schema for the project this session associated with.

finalizeback to summary
public void finalize()

Overrides java.lang.Object.finalize.

INTERNAL: Close the schema writer when the schema manger is garbage collected

Annotations
@Override
generateStoredProceduresback to summary
public void generateStoredProcedures() throws EclipseLinkException

PUBLIC: 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.

generateStoredProceduresback to summary
public void generateStoredProcedures(Writer writer) throws EclipseLinkException

PUBLIC: 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.

generateStoredProceduresAndAmendmentClassback to summary
public void generateStoredProceduresAndAmendmentClass(Writer writer, String fullyQualifiedClassName) throws EclipseLinkException

PUBLIC: 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.

generateStoredProceduresAndAmendmentClassback to summary
public void generateStoredProceduresAndAmendmentClass(String path, String fullyQualifiedClassName) throws EclipseLinkException

PUBLIC: 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.

getAccessorback to summary
protected DatabaseAccessor getAccessor()

Return the appropriate accessor. Assume we are dealing with a JDBC accessor.

getAllColumnNamesback to summary
public Vector<AbstractRecord> getAllColumnNames(String tableName) throws DatabaseException

Get a description of table columns available in a catalog.

Each column description has the following columns:

  1. TABLE_CAT String => table catalog (may be null)
  2. TABLE_SCHEM String => table schema (may be null)
  3. TABLE_NAME String => table name
  4. COLUMN_NAME String => column name
  5. DATA_TYPE short => SQL type from java.sql.Types
  6. TYPE_NAME String => Data source dependent type name
  7. 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.
  8. BUFFER_LENGTH is not used.
  9. DECIMAL_DIGITS int => the number of fractional digits
  10. NUM_PREC_RADIX int => Radix (typically either 10 or 2)
  11. NULLABLE int => is NULL allowed?
    • columnNoNulls - might not allow NULL values
    • columnNullable - definitely allows NULL values
    • columnNullableUnknown - nullability unknown
  12. REMARKS String => comment describing column (may be null)
  13. COLUMN_DEF String => default value (may be null)
  14. SQL_DATA_TYPE int => unused
  15. SQL_DATETIME_SUB int => unused
  16. CHAR_OCTET_LENGTH int => for char types the maximum number of bytes in the column
  17. ORDINAL_POSITION int => index of column in table (starting at 1)
  18. 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:String

a table name pattern

Returns:Vector<AbstractRecord>

a Vector of Records.

getAllColumnNamesback to summary
public Vector<AbstractRecord> getAllColumnNames(String creatorName, String tableName) throws DatabaseException

Get a description of table columns available in a catalog.

Each column description has the following columns:

  1. TABLE_CAT String => table catalog (may be null)
  2. TABLE_SCHEM String => table schema (may be null)
  3. TABLE_NAME String => table name
  4. COLUMN_NAME String => column name
  5. DATA_TYPE short => SQL type from java.sql.Types
  6. TYPE_NAME String => Data source dependent type name
  7. 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.
  8. BUFFER_LENGTH is not used.
  9. DECIMAL_DIGITS int => the number of fractional digits
  10. NUM_PREC_RADIX int => Radix (typically either 10 or 2)
  11. NULLABLE int => is NULL allowed?
    • columnNoNulls - might not allow NULL values
    • columnNullable - definitely allows NULL values
    • columnNullableUnknown - nullability unknown
  12. REMARKS String => comment describing column (may be null)
  13. COLUMN_DEF String => default value (may be null)
  14. SQL_DATA_TYPE int => unused
  15. SQL_DATETIME_SUB int => unused
  16. CHAR_OCTET_LENGTH int => for char types the maximum number of bytes in the column
  17. ORDINAL_POSITION int => index of column in table (starting at 1)
  18. 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:String

a schema name pattern; "" retrieves those without a schema

tableName:String

a table name pattern

Returns:Vector<AbstractRecord>

a Vector of Records.

getAllTableNamesback to summary
public Vector<AbstractRecord> getAllTableNames() throws DatabaseException

Get a description of tables available in a catalog.

Each table description has the following columns:

  1. TABLE_CAT String => table catalog (may be null)
  2. TABLE_SCHEM String => table schema (may be null)
  3. TABLE_NAME String => table name
  4. TABLE_TYPE String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
  5. REMARKS String => explanatory comment on the table

Note

Some databases may not return information for all tables.

Returns:Vector<AbstractRecord>

a Vector of Records.

getAllTableNamesback to summary
public Vector<AbstractRecord> getAllTableNames(String creatorName) throws DatabaseException

Get a description of table columns available in a catalog.

Each column description has the following columns:

  1. TABLE_CAT String => table catalog (may be null)
  2. TABLE_SCHEM String => table schema (may be null)
  3. TABLE_NAME String => table name
  4. COLUMN_NAME String => column name
  5. DATA_TYPE short => SQL type from java.sql.Types
  6. TYPE_NAME String => Data source dependent type name
  7. 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.
  8. BUFFER_LENGTH is not used.
  9. DECIMAL_DIGITS int => the number of fractional digits
  10. NUM_PREC_RADIX int => Radix (typically either 10 or 2)
  11. NULLABLE int => is NULL allowed?
    • columnNoNulls - might not allow NULL values
    • columnNullable - definitely allows NULL values
    • columnNullableUnknown - nullability unknown
  12. REMARKS String => comment describing column (may be null)
  13. COLUMN_DEF String => default value (may be null)
  14. SQL_DATA_TYPE int => unused
  15. SQL_DATETIME_SUB int => unused
  16. CHAR_OCTET_LENGTH int => for char types the maximum number of bytes in the column
  17. ORDINAL_POSITION int => index of column in table (starting at 1)
  18. 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:String

a schema name pattern; "" retrieves those without a schema

Returns:Vector<AbstractRecord>

a Vector of Records.

getColumnInfoback to summary
public Vector<AbstractRecord> getColumnInfo(String catalog, String schema, String tableName, String columnName) throws DatabaseException

Get 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:

  1. TABLE_CAT String => table catalog (may be null)
  2. TABLE_SCHEM String => table schema (may be null)
  3. TABLE_NAME String => table name
  4. COLUMN_NAME String => column name
  5. DATA_TYPE short => SQL type from java.sql.Types
  6. TYPE_NAME String => Data source dependent type name
  7. 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.
  8. BUFFER_LENGTH is not used.
  9. DECIMAL_DIGITS int => the number of fractional digits
  10. NUM_PREC_RADIX int => Radix (typically either 10 or 2)
  11. NULLABLE int => is NULL allowed?
    • columnNoNulls - might not allow NULL values
    • columnNullable - definitely allows NULL values
    • columnNullableUnknown - nullability unknown
  12. REMARKS String => comment describing column (may be null)
  13. COLUMN_DEF String => default value (may be null)
  14. SQL_DATA_TYPE int => unused
  15. SQL_DATETIME_SUB int => unused
  16. CHAR_OCTET_LENGTH int => for char types the maximum number of bytes in the column
  17. ORDINAL_POSITION int => index of column in table (starting at 1)
  18. 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:String

a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria

schema:String

a schema name pattern; "" retrieves those without a schema

tableName:String

a table name pattern

columnName:String

a column name pattern

Returns:Vector<AbstractRecord>

a Vector of Records.

getColumnInfoback to summary
public Vector<AbstractRecord> getColumnInfo(String tableName, String columnName) throws DatabaseException
getDefaultTableCreatorback to summary
protected TableCreator getDefaultTableCreator(boolean generateFKConstraints)

Construct the default TableCreator. If the default TableCreator is already created, just returns it.

getDropSchemaWriterback to summary
protected Writer getDropSchemaWriter()
getSessionback to summary
public AbstractSession getSession()
getTableInfoback to summary
public Vector<AbstractRecord> getTableInfo(String catalog, String schema, String tableName, String[] types) throws DatabaseException

Get 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:

  1. TABLE_CAT String => table catalog (may be null)
  2. TABLE_SCHEM String => table schema (may be null)
  3. TABLE_NAME String => table name
  4. TABLE_TYPE String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
  5. REMARKS String => explanatory comment on the table

Note

Some databases may not return information for all tables.

Parameters
catalog:String

a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria

schema:String

a schema name pattern; "" retrieves those without a schema

tableName:String

a table name pattern

types:String[]

a list of table types to include; null returns all types

Returns:Vector<AbstractRecord>

a Vector of Records.

getWriterback to summary
protected Writer getWriter(String fileName)
outputCreateDDLToFileback to summary
public void outputCreateDDLToFile(String fileName)
outputCreateDDLToWriterback to summary
public void outputCreateDDLToWriter(Writer createWriter)
outputDDLToDatabaseback to summary
public void outputDDLToDatabase()

PUBLIC: Output all DDL statements directly to the database.

outputDDLToFileback to summary
public void outputDDLToFile(String fileName)

PUBLIC: Output all DDL statements to a file writer specified by the name in the parameter.

outputDDLToWriterback to summary
public void outputDDLToWriter(Writer schemaWriter)

PUBLIC: Output all DDL statements to a writer specified in the parameter.

outputDropDDLToFileback to summary
public void outputDropDDLToFile(String fileName)
outputDropDDLToWriterback to summary
public void outputDropDDLToWriter(Writer dropWriter)
processSequenceDefinitionback to summary
protected void processSequenceDefinition(SequenceDefinition definition, final boolean createTables, final boolean createSequences, final boolean replace, Set<String> createdTableNames, Set<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:SequenceDefinition

- the sequence definition

createTables:boolean

- true if table sequence table definitions should be created.

createSequences:boolean

- true if the sequence definition should be created, false if it should be dropped.

replace:boolean

- true if table definitions and sequence definitions should be replaced.

processSequenceDefinitionsback to summary
protected void processSequenceDefinitions(boolean createSequenceTables, boolean createSequences, boolean replaceSequences) throws EclipseLinkException

Common implementor for createSequence and replaceSequence, distinguishes between sequence tables and sequence objects

Parameters
createSequenceTables:boolean

- true to create the sequences tables, false to replace them (dropped then create)

createSequences:boolean

- true to create the sequences objects, false to replace them (dropped then create)

replaceSequences:boolean

- true to actually replace, false to drop only.

replaceDefaultTablesback to summary
public void replaceDefaultTables() throws EclipseLinkException

Drop and recreate the default table schema for the project this session associated with.

replaceDefaultTablesback to summary
public void replaceDefaultTables(boolean createSequenceTables, boolean generateFKConstraints) throws EclipseLinkException

Drop and recreate the default table schema for the project this session associated with.

replaceDefaultTablesback to summary
public void replaceDefaultTables(boolean createSequenceTables, boolean createSequences, boolean generateFKConstraints) throws EclipseLinkException

Drop and recreate the default table schema for the project this session associated with.

replaceObjectback to summary
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.

replaceSequencesback to summary
public void replaceSequences() throws EclipseLinkException

Drop and recreate all the receiver's sequences on the database for all of the loaded descriptors.

setCreateDatabaseSchemasback to summary
public void setCreateDatabaseSchemas(boolean createDatabaseSchemas)

INTERNAL: Set to true if database schemas should be built during the DDL generation.

setCreateSQLFilesback to summary
public void setCreateSQLFiles(boolean genFlag)
setSessionback to summary
public void setSession(DatabaseSessionImpl session)
shouldCreateDatabaseSchemaback to summary
protected boolean shouldCreateDatabaseSchema(DatabaseObjectDefinition databaseObjectDefinition, Set<String> createdDatabaseSchemas)

INTERNAL: Returns true if a database schema should be created during ddl generation for the given databaseObjectDefinition.

shouldWriteToDatabaseback to summary
public boolean shouldWriteToDatabase()

PUBLIC: Return true if this SchemaManager should write to the database directly