Module eclipselink

Interface DDLPlatform

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 Details

  • Method Details

    • getJavaTypes

      default Map<String,Class<?>> getJavaTypes()
      Return the database type to class type mappings for the schema framework.
    • getDatabaseTypes

      default Map<Class<?>,FieldDefinition.DatabaseType> getDatabaseTypes()
      Return the class type to database type mappings for the schema framework.
    • getDatabaseType

      default FieldDefinition.DatabaseType getDatabaseType(String typeName)
      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

      default FieldDefinition.DatabaseType getDatabaseType(Class<?> type)
      Returns the field type definition for the given Java type.
      Parameters:
      type - the Java class representing the type
      Returns:
      the field type definition
    • getDatabaseType

      default FieldDefinition.DatabaseType getDatabaseType(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 is null and 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 on
      indexName - name of the index
      qualifier - qualifier to construct qualified name of index if needed
      isUnique - Indicates whether unique index is created
      columnNames - one or more columns the index is created for
    • buildDropIndex

      default String buildDropIndex(String fullTableName, String indexName, String qualifier)
      INTERNAL: Override this method with the platform's DROP INDEX statement.
      Parameters:
      fullTableName - qualified name of the table the index is to be removed from
      indexName - name of the index
      qualifier - 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

      default String getBatchBeginString()
      Used for batch writing and sp defs.
    • getBatchDelimiterString

      default String getBatchDelimiterString()
      Used for batch writing and sp defs.
    • getBatchEndString

      default String getBatchEndString()
      Used for batch writing and sp defs.
    • getConstraintDeletionString

      default String getConstraintDeletionString()
      Used for constraint deletion.
    • getCreateViewString

      default String 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

      default String getDropCascadeString()
      Allows DROP TABLE to cascade dropping of any dependent constraints if the database supports this option.
    • getIndexNamePrefix

      default String getIndexNamePrefix(boolean isUniqueSetOnField)
      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

      default String getProcedureAsString()
      Used for stored procedure defs.
    • getProcedureBeginString

      default String getProcedureBeginString()
      Used for stored procedure defs.
    • getProcedureEndString

      default String getProcedureEndString()
      Used for stored procedure defs.
    • getProcedureOptionList

      default String getProcedureOptionList()
      Some platforms have an option list Only to be used for stored procedure creation.
      See Also:
    • getStoredProcedureTerminationToken

      default String getStoredProcedureTerminationToken()
    • getUniqueConstraintDeletionString

      default String 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

      default void printFieldIdentityClause(Writer writer) throws IOException
      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

      default void printFieldNotNullClause(Writer writer) throws IOException
      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

      default void printFieldNullClause(Writer writer) throws IOException
      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 to
      field - the field definition
      databaseType - the field type definition
      shouldPrintFieldIdentityClause - 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 to
      shouldPrintFieldUniqueClause - 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 true when current database platform supports fractional seconds precision or false otherwise
    • 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

      default void writeTableCreationSuffix(Writer writer, String creationSuffix) throws IOException
      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 to
      creationSuffix - any additional user-provided suffix
      Throws:
      IOException - if an I/O error occurs while writing
    • getTableCreationSuffix

      default String 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

      default String 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

      default String 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

      default String getCreateDatabaseSchemaString(String schema)
      Return the create schema SQL syntax. Subclasses should override as needed.
    • getDropDatabaseSchemaString

      default String getDropDatabaseSchemaString(String schema)
      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

      default String getCreationOutputProcedureToken()
      This method is used to print the required output parameter token for the specific platform. Used when stored procedures are created.
    • getOutputProcedureToken

      default String getOutputProcedureToken()
      This method is used to print the output parameter token when stored procedures are called
    • getProcedureArgumentString

      default String getProcedureArgumentString()
      Used for sp defs.
    • allowsSizeInProcedureArguments

      default boolean allowsSizeInProcedureArguments()
      Used for stored procedure definitions.
    • getInOutputProcedureToken

      default String getInOutputProcedureToken()
      This method is used to print the output parameter token when stored procedures are called
    • getCreationInOutputProcedureToken

      default String 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

      default String getInputProcedureToken()
      Used for stored procedure creation: Prefix for INPUT parameters. Not required on most platforms.