Module eclipselink

Class FieldDefinition.DatabaseType

  • Enclosing class:
    FieldDefinition

    public static final class FieldDefinition.DatabaseType
    extends Object
    PUBLIC: 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 Detail

      • DatabaseType

        public DatabaseType​(String name)
      • DatabaseType

        public DatabaseType​(String name,
                            int defaultSize)
      • 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,
                            boolean allowNull,
                            boolean allowSize,
                            boolean requireSize,
                            int defaultSize,
                            int defaultSubSize,
                            int maxPrecision,
                            int minScale,
                            int maxScale)
    • Method Detail

      • 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()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object