- All Known Implementing Classes:
AccessPlatform,AttunityPlatform,CloudscapePlatform,org.eclipse.persistence.internal.databaseaccess.DatabasePlatform,DatabasePlatform,DB2MainframePlatform,DB2Platform,DB2ZPlatform,DBasePlatform,DerbyPlatform,FirebirdPlatform,H2Platform,HANAPlatform,HSQLPlatform,Informix11Platform,InformixPlatform,JavaDBPlatform,MariaDBPlatform,MaxDBPlatform,MySQLPlatform,Oracle10Platform,Oracle10Platform,Oracle11Platform,Oracle11Platform,Oracle12Platform,Oracle12Platform,Oracle18Platform,Oracle18Platform,Oracle19Platform,Oracle19Platform,Oracle21Platform,Oracle21Platform,Oracle23Platform,Oracle23Platform,Oracle8Platform,Oracle8Platform,Oracle9Platform,Oracle9Platform,OraclePlatform,PervasivePlatform,PointBasePlatform,PostgreSQL10Platform,PostgreSQLPlatform,SQLAnywherePlatform,SQLServerPlatform,SybasePlatform,SymfowarePlatform,TimesTen7Platform,TimesTenPlatform
public interface DDLPlatform
This interface provides a contract for database platform-specific DDL generation behaviors.
Implementations of this interface can be used to customize or extend DDL printing logic
without modifying the core
org.eclipse.persistence.platform.database.DatabasePlatform class.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Map<Class<?>, FieldDefinition.DatabaseType> static final FieldDefinition.DatabaseTypestatic final FieldDefinition.DatabaseTypestatic final FieldDefinition.DatabaseTypestatic final FieldDefinition.DatabaseTypestatic final FieldDefinition.DatabaseTypestatic final FieldDefinition.DatabaseTypestatic final FieldDefinition.DatabaseTypestatic final FieldDefinition.DatabaseTypestatic final FieldDefinition.DatabaseTypestatic final FieldDefinition.DatabaseTypestatic final FieldDefinition.DatabaseTypestatic final FieldDefinition.DatabaseTypestatic final FieldDefinition.DatabaseTypestatic final FieldDefinition.DatabaseTypestatic final FieldDefinition.DatabaseTypestatic final FieldDefinition.DatabaseTypestatic final FieldDefinition.DatabaseTypestatic final FieldDefinition.DatabaseTypestatic final FieldDefinition.DatabaseType -
Method Summary
Modifier and TypeMethodDescriptiondefault booleanUsed for stored procedure definitions.default StringbuildCreateIndex(String fullTableName, String indexName, String qualifier, boolean isUnique, String... columnNames) INTERNAL: Override this method with the platform's CREATE INDEX statement.default StringbuildDropIndex(String fullTableName, String indexName, String qualifier) INTERNAL: Override this method with the platform's DROP INDEX statement.default WriterbuildSequenceObjectAlterIncrementWriter(Writer writer, String fullSeqName, int increment) INTERNAL: Returns sql used to alter sequence object's increment in the database.default WriterbuildSequenceObjectCreationWriter(Writer writer, String fullSeqName, int increment, int start) INTERNAL: Returns sql used to create sequence object in the database.default WriterbuildSequenceObjectDeletionWriter(Writer writer, String fullSeqName) INTERNAL: Returns sql used to delete sequence object from the database.default StringUsed for batch writing and sp defs.default StringUsed for batch writing and sp defs.default StringUsed for batch writing and sp defs.default StringUsed for constraint deletion.default StringgetCreateDatabaseSchemaString(String schema) Return the create schema SQL syntax.default StringReturns the platform-specific string for creating a view (e.g., "CREATE VIEW" or "CREATE OR REPLACE VIEW").default StringThis method is used to print the required output parameter token for the specific platform.default StringThis method is used to print the required output parameter token for the specific platform.default FieldDefinition.DatabaseTypegetDatabaseType(Class<?> type) Returns the field type definition for the given Java type.default FieldDefinition.DatabaseTypegetDatabaseType(Class<?> type, String name) INTERNAL: Retrieve database platform specific field definition from database specific platform handler for existing type or build a new one when type isnulland type for type name could not be found.default FieldDefinition.DatabaseTypegetDatabaseType(String typeName) Returns the field type definition for the given Java type name.default Map<Class<?>, FieldDefinition.DatabaseType> Return the class type to database type mappings for the schema framework.default StringAllows DROP TABLE to cascade dropping of any dependent constraints if the database supports this option.default StringgetDropDatabaseSchemaString(String schema) Return the drop schema SQL syntax.default StringDelimiter to use for fields and tables using spaces or other special values.default StringgetIndexNamePrefix(boolean isUniqueSetOnField) Used to allow platforms to define their own index prefixesdefault StringThis method is used to print the output parameter token when stored procedures are calleddefault StringUsed for stored procedure creation: Prefix for INPUT parameters.Return the database type to class type mappings for the schema framework.default intINTERNAL: returns the maximum number of characters that can be used in a field name on this platform.default intINTERNAL: returns the maximum number of characters that can be used in a foreign key name on this platform.default intINTERNAL: returns the maximum number of characters that can be used in an index name on this platform.default intReturns the maximum allowed size for unique key names on this platform.default StringThis method is used to print the output parameter token when stored procedures are calleddefault StringUsed for sp defs.default StringUsed for stored procedure defs.default StringUsed for stored procedure defs.default StringUsed for stored procedure defs.default StringSome platforms have an option list Only to be used for stored procedure creation.default StringDelimiter to use for fields and tables using spaces or other special values.default Stringdefault StringGet the String used on all table creation statements generated from the DefaultTableGenerator with a session using this project (DDL generation).default StringUsed for constraint deletion.default booleanINTERNAL: Override this method if the platform supports sequence objects and it's possible to alter sequence object's increment in the database.default voidprintFieldIdentityClause(Writer writer) Prints the platform-specific identity clause for a field (e.g., AUTO_INCREMENT).default voidprintFieldNotNullClause(Writer writer) Prints the platform-specific NOT NULL clause for a field.default voidprintFieldNullClause(Writer writer) Prints the platform-specific NULL clause for a field.default voidprintFieldTypeSize(Writer writer, FieldDefinition field, FieldDefinition.DatabaseType databaseType) default voidprintFieldTypeSize(Writer writer, FieldDefinition field, FieldDefinition.DatabaseType databaseType, boolean shouldPrintFieldIdentityClause) Prints the field type size clause to the writer, including type name and optional size.default voidprintFieldUnique(Writer writer, boolean shouldPrintFieldUniqueClause) Prints the platform-specific UNIQUE clause for a field.default booleanIndicates whether the platform requires named primary key constraints.default booleanUsed for stored procedure creation: Some platforms need brackets around arguments declaration even if no arguments exist.default booleanINTERNAL: Return if this database requires the table name when dropping an index.default booleanUsed for table creation.default booleanUsed for table creation.default booleanUsed for table creation.default booleanUsed for table creation.default booleanSome Platforms want the constraint name after the constraint definition.default booleanUsed for stored procedure creation: Some platforms want to print prefix for INPUT arguments BEFORE NAME.default booleanThis is required in the construction of the stored procedures with output parametersdefault booleanThis is required in the construction of the stored procedures with output parametersdefault booleanUsed for stored procedure creation: Some platforms declare variables AFTER the procedure body's BEGIN string.default booleandefault booleandefault booleanOverride this method if the platform supports setting fractional seconds precision in a SQL time or timestamp data type.default booleanINTERNAL: Return if this database support index creation.default booleanIndicates whether the platform supports primary key constraints.default booleandefault booleanIndicates whether the platform supports unique columns (e.g., UNIQUE keyword on column).default booleandefault voidwriteTableCreationSuffix(Writer writer, String creationSuffix) Writes the platform-specific table creation suffix to the provided writer.
-
Field Details
-
TYPE_BLOB
-
TYPE_CLOB
-
TYPE_DATE
-
TYPE_TIME
-
TYPE_TIMESTAMP
-
TYPE_CHAR
-
TYPE_VARCHAR
-
TYPE_NUMBER
-
TYPE_NUMERIC
-
TYPE_BOOLEAN
-
TYPE_INTEGER
-
TYPE_LONG
-
TYPE_FLOAT
-
TYPE_DOUBLE
-
TYPE_SHORT
-
TYPE_BYTE
-
TYPE_BIG_DECIMAL
-
TYPE_BIG_INTEGER
-
TYPE_BINARY
-
DB_TYPES
-
CLASS_TYPES
-
-
Method Details
-
getJavaTypes
Return the database type to class type mappings for the schema framework. -
getDatabaseTypes
Return the class type to database type mappings for the schema framework. -
getDatabaseType
Returns the field type definition for the given Java type name.- Parameters:
typeName- the Java class representing the type- Returns:
- the field type definition
-
getDatabaseType
Returns the field type definition for the given Java type.- Parameters:
type- the Java class representing the type- Returns:
- the field type definition
-
getDatabaseType
INTERNAL: Retrieve database platform specific field definition from database specific platform handler for existing type or build a new one when type isnulland type for type name could not be found.- Parameters:
type- Field type (will be processed first when available).name- Field type name (will be processed as backup option when type class is not available).- Throws:
RuntimeException- when provided type is not valid database type.
-
buildCreateIndex
default String buildCreateIndex(String fullTableName, String indexName, String qualifier, boolean isUnique, String... columnNames) INTERNAL: Override this method with the platform's CREATE INDEX statement.- Parameters:
fullTableName- qualified name of the table the index is to be created onindexName- name of the indexqualifier- qualifier to construct qualified name of index if neededisUnique- Indicates whether unique index is createdcolumnNames- one or more columns the index is created for
-
buildDropIndex
INTERNAL: Override this method with the platform's DROP INDEX statement.- Parameters:
fullTableName- qualified name of the table the index is to be removed fromindexName- name of the indexqualifier- qualifier to construct qualified name of index if needed
-
buildSequenceObjectAlterIncrementWriter
default Writer buildSequenceObjectAlterIncrementWriter(Writer writer, String fullSeqName, int increment) throws IOException INTERNAL: Returns sql used to alter sequence object's increment in the database.- Throws:
IOException
-
buildSequenceObjectCreationWriter
default Writer buildSequenceObjectCreationWriter(Writer writer, String fullSeqName, int increment, int start) throws IOException INTERNAL: Returns sql used to create sequence object in the database.- Throws:
IOException
-
buildSequenceObjectDeletionWriter
default Writer buildSequenceObjectDeletionWriter(Writer writer, String fullSeqName) throws IOException INTERNAL: Returns sql used to delete sequence object from the database.- Throws:
IOException
-
getBatchBeginString
Used for batch writing and sp defs. -
getBatchDelimiterString
Used for batch writing and sp defs. -
getBatchEndString
Used for batch writing and sp defs. -
getConstraintDeletionString
Used for constraint deletion. -
getCreateViewString
Returns the platform-specific string for creating a view (e.g., "CREATE VIEW" or "CREATE OR REPLACE VIEW").- Returns:
- the create view string
-
getDropCascadeString
Allows DROP TABLE to cascade dropping of any dependent constraints if the database supports this option. -
getIndexNamePrefix
Used to allow platforms to define their own index prefixes -
getMaxFieldNameSize
default int getMaxFieldNameSize()INTERNAL: returns the maximum number of characters that can be used in a field name on this platform. -
getMaxIndexNameSize
default int getMaxIndexNameSize()INTERNAL: returns the maximum number of characters that can be used in an index name on this platform. -
getMaxUniqueKeyNameSize
default int getMaxUniqueKeyNameSize()Returns the maximum allowed size for unique key names on this platform.- Returns:
- the maximum unique key name size
-
getMaxForeignKeyNameSize
default int getMaxForeignKeyNameSize()INTERNAL: returns the maximum number of characters that can be used in a foreign key name on this platform. -
getProcedureAsString
Used for stored procedure defs. -
getProcedureBeginString
Used for stored procedure defs. -
getProcedureEndString
Used for stored procedure defs. -
getProcedureOptionList
Some platforms have an option list Only to be used for stored procedure creation.- See Also:
-
getStoredProcedureTerminationToken
-
getUniqueConstraintDeletionString
Used for constraint deletion. -
isAlterSequenceObjectSupported
default boolean isAlterSequenceObjectSupported()INTERNAL: Override this method if the platform supports sequence objects and it's possible to alter sequence object's increment in the database. -
printFieldIdentityClause
Prints the platform-specific identity clause for a field (e.g., AUTO_INCREMENT).- Parameters:
writer- the writer to append to- Throws:
IOException- if an I/O error occurs while writing
-
printFieldNotNullClause
Prints the platform-specific NOT NULL clause for a field.- Parameters:
writer- the writer to append to- Throws:
IOException- if an I/O error occurs while writing
-
printFieldNullClause
Prints the platform-specific NULL clause for a field.- Parameters:
writer- the writer to append to- Throws:
IOException- if an I/O error occurs while writing
-
printFieldTypeSize
default void printFieldTypeSize(Writer writer, FieldDefinition field, FieldDefinition.DatabaseType databaseType, boolean shouldPrintFieldIdentityClause) throws IOException Prints the field type size clause to the writer, including type name and optional size.- Parameters:
writer- the writer to append tofield- the field definitiondatabaseType- the field type definitionshouldPrintFieldIdentityClause- indicates if the identity clause should be printed- Throws:
IOException- if an I/O error occurs while writing
-
printFieldTypeSize
default void printFieldTypeSize(Writer writer, FieldDefinition field, FieldDefinition.DatabaseType databaseType) throws IOException - Throws:
IOException
-
printFieldUnique
default void printFieldUnique(Writer writer, boolean shouldPrintFieldUniqueClause) throws IOException Prints the platform-specific UNIQUE clause for a field.- Parameters:
writer- the writer to append toshouldPrintFieldUniqueClause- indicates if the identity clause should be printed- Throws:
IOException- if an I/O error occurs while writing
-
requiresNamedPrimaryKeyConstraints
default boolean requiresNamedPrimaryKeyConstraints()Indicates whether the platform requires named primary key constraints.- Returns:
- true if named primary key constraints are required; false otherwise
-
requiresProcedureBrackets
default boolean requiresProcedureBrackets()Used for stored procedure creation: Some platforms need brackets around arguments declaration even if no arguments exist. Those platform will override this and return true. All other platforms will omit the brackets in this case. -
requiresTableInIndexDropDDL
default boolean requiresTableInIndexDropDDL()INTERNAL: Return if this database requires the table name when dropping an index. -
requiresUniqueConstraintCreationOnTableCreate
default boolean requiresUniqueConstraintCreationOnTableCreate()Used for table creation. If a database platform does not support ALTER TABLE syntax to add/drop unique constraints (like Symfoware), overriding this method will allow the constraint to be specified in the CREATE TABLE statement.This only affects unique constraints specified using the UniqueConstraint annotation or equivalent method. Columns for which the 'unique' attribute is set to true will be declared 'UNIQUE' in the CREATE TABLE statement regardless of the return value of this method.
- Returns:
- whether unique constraints should be declared as part of the CREATE TABLE statement instead of in separate ALTER TABLE ADD/DROP statements.
-
shouldCreateIndicesForPrimaryKeys
default boolean shouldCreateIndicesForPrimaryKeys()Used for table creation. Most databases create an index automatically when a primary key is created. Symfoware does not.- Returns:
- whether an index should be created explicitly for primary keys
-
shouldCreateIndicesOnForeignKeys
default boolean shouldCreateIndicesOnForeignKeys()Used for table creation. Most databases do not create an index automatically for foreign key columns. Normally it is recommended to index foreign key columns. This allows for foreign key indexes to be configured, by default foreign keys are not indexed.- Returns:
- whether an index should be created explicitly for foreign key constraints
-
shouldCreateIndicesOnUniqueKeys
default boolean shouldCreateIndicesOnUniqueKeys()Used for table creation. Most databases create an index automatically for columns with a unique constraint. Symfoware does not.- Returns:
- whether an index should be created explicitly for unique constraints
-
shouldPrintConstraintNameAfter
default boolean shouldPrintConstraintNameAfter()Some Platforms want the constraint name after the constraint definition. -
shouldPrintStoredProcedureVariablesAfterBeginString
default boolean shouldPrintStoredProcedureVariablesAfterBeginString()Used for stored procedure creation: Some platforms declare variables AFTER the procedure body's BEGIN string. These need to override and return true. All others will print the variable declaration BEFORE the body's BEGIN string. -
supportsDeleteOnCascade
default boolean supportsDeleteOnCascade() -
supportsFractionalTime
default boolean supportsFractionalTime()Override this method if the platform supports setting fractional seconds precision in a SQL time or timestamp data type.- Returns:
- value of
truewhen current database platform supports fractional seconds precision orfalseotherwise
-
supportsForeignKeyConstraints
default boolean supportsForeignKeyConstraints() -
supportsUniqueKeyConstraints
default boolean supportsUniqueKeyConstraints() -
supportsIndexes
default boolean supportsIndexes()INTERNAL: Return if this database support index creation. -
supportsPrimaryKeyConstraint
default boolean supportsPrimaryKeyConstraint()Indicates whether the platform supports primary key constraints.- Returns:
- true if primary key constraints are supported; false otherwise
-
supportsStoredFunctions
default boolean supportsStoredFunctions() -
supportsUniqueColumns
default boolean supportsUniqueColumns()Indicates whether the platform supports unique columns (e.g., UNIQUE keyword on column).- Returns:
- true if unique columns are supported; false otherwise
-
writeTableCreationSuffix
Writes the platform-specific table creation suffix to the provided writer. This may include storage clauses, tablespace definitions, or other platform-specific DDL.- Parameters:
writer- the writer to append the suffix tocreationSuffix- any additional user-provided suffix- Throws:
IOException- if an I/O error occurs while writing
-
getTableCreationSuffix
Get the String used on all table creation statements generated from the DefaultTableGenerator with a session using this project (DDL generation). This value will be appended to CreationSuffix strings stored on the DatabaseTable or TableDefinition. -
getEndDelimiter
Delimiter to use for fields and tables using spaces or other special values.Some databases use different delimiters for the beginning and end of the value. This delimiter indicates the end of the value.
-
getStartDelimiter
Delimiter to use for fields and tables using spaces or other special values.Some databases use different delimiters for the beginning and end of the value. This delimiter indicates the start of the value.
-
getCreateDatabaseSchemaString
Return the create schema SQL syntax. Subclasses should override as needed. -
getDropDatabaseSchemaString
Return the drop schema SQL syntax. Subclasses should override as needed. -
shouldPrintOutputTokenBeforeType
default boolean shouldPrintOutputTokenBeforeType()This is required in the construction of the stored procedures with output parameters -
shouldPrintOutputTokenAtStart
default boolean shouldPrintOutputTokenAtStart()This is required in the construction of the stored procedures with output parameters -
getCreationOutputProcedureToken
This method is used to print the required output parameter token for the specific platform. Used when stored procedures are created. -
getOutputProcedureToken
This method is used to print the output parameter token when stored procedures are called -
getProcedureArgumentString
Used for sp defs. -
allowsSizeInProcedureArguments
default boolean allowsSizeInProcedureArguments()Used for stored procedure definitions. -
getInOutputProcedureToken
This method is used to print the output parameter token when stored procedures are called -
getCreationInOutputProcedureToken
This method is used to print the required output parameter token for the specific platform. Used when stored procedures are created. -
shouldPrintInputTokenAtStart
default boolean shouldPrintInputTokenAtStart()Used for stored procedure creation: Some platforms want to print prefix for INPUT arguments BEFORE NAME. If wanted, override and return true. -
getInputProcedureToken
Used for stored procedure creation: Prefix for INPUT parameters. Not required on most platforms.
-