Module eclipselink

Class FieldDefinition.DatabaseType

java.lang.Object
org.eclipse.persistence.tools.schemaframework.FieldDefinition.DatabaseType
Enclosing class:
FieldDefinition

public static final class FieldDefinition.DatabaseType extends Object
Purpose: Define a database-platform-specific definition for a platform independent Java class type. This is used for the field creation within a table creation statement.

Responsibilities:

  • Store a default size and know if the size option is required or optional.
  • Store the name of the real database type.
  • Maintain maximum precision and optional min & max Scale.
  • Constructor Details

    • DatabaseType

      public DatabaseType(String name)
    • DatabaseType

      public DatabaseType(String name, int defaultSize)
    • DatabaseType

      public DatabaseType(String name, int defaultSize, String suffix)
    • DatabaseType

      public DatabaseType(String name, int defaultSize, int defaultSubSize)
    • DatabaseType

      public DatabaseType(String name, int defaultSize, int defaultSubSize, int maxPrecision, int minScale, int maxScale)
    • DatabaseType

      public DatabaseType(String name, boolean allowSize)
    • DatabaseType

      public DatabaseType(String name, boolean allowSize, boolean allowNull)
    • DatabaseType

      public DatabaseType(String name, String suffix, boolean allowNull, boolean allowSize, boolean requireSize, int defaultSize, int defaultSubSize, int maxPrecision, int minScale, int maxScale)
  • Method Details

    • ofSize

      public FieldDefinition.DatabaseType ofSize(int size)
    • ofNoSize

      public FieldDefinition.DatabaseType ofNoSize()
    • name

      public String name()
      Return the name. Can be any database primitive type name, this name will then be mapped to the Java primitive type, the database type varies by platform, and the mappings can be found in the subclasses of DDLPlatform.

      Java names and their ODBC mappings include
      Java nameODBC mapping
      IntegerSQL_INT
      FloatSQL_FLOAT
      DoubleSQL_DOUBLE
      LongSQL_LONG
      ShortSQL_INT
      BigDecimalSQL_NUMERIC
      BigIntegerSQL_NUMERIC
      StringSQL_VARCHAR
      ArrayBLOB
      Character[]SQL_CHAR
      BooleanSQL_BOOL
      TextCLOB
      DateSQL_DATE
      TimeSQL_TIME
      TimestampSQL_TIMESTAMP
    • allowNull

      public boolean allowNull()
      Return if this type is allowed to be null for this platform
    • allowSize

      public boolean allowSize()
      Return if this type can support a size specification.
    • requireSize

      public boolean requireSize()
      Return if this type must have a size specification.
    • defaultSize

      public int defaultSize()
      Return the default size for this type. This default size will be used if the database requires specification of a size, and the table definition did not provide one.
    • defaultSubSize

      public int defaultSubSize()
      Return the default sub-size for this type. This default size will be used if the database requires specification of a size, and the table definition did not provide one.
    • maxPrecision

      public int maxPrecision()
    • maxScale

      public int maxScale()
    • minScale

      public int minScale()
    • suffix

      public String suffix()
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object