- Type Parameters:
T
- The Java type associated with this SQL data type
- All Superinterfaces:
Named
,QueryPart
,Serializable
- All Known Implementing Classes:
BuiltInDataType
,DefaultDataType
jOOQ provides built in data types through SQLDataType
. Users can
define their own data types programmatically by calling
asConvertedDataType(Converter)
or
asConvertedDataType(Binding)
, for example. Custom data types can
also be defined on generated code using the <forcedType/>
configuration, see the manual for more details
- Author:
- Lukas Eder
-
Method Summary
Modifier and TypeMethodDescription<A extends ArrayRecord<?>>
@NotNull DataType<A>asArrayDataType
(Class<A> arrayDataType) Retrieve the data type for an Oracle-style ARRAY of this data type.<A extends AssociativeArrayRecord<?,
?>>
@NotNull DataType<A>asAssociativeArrayDataType
(Class<A> arrayDataType) Retrieve the data type for an Oracle-style associative array of this data type.default <U> @NotNull DataType<U>
asConvertedDataType
(Class<U> toType, Function<? super T, ? extends U> from, Function<? super U, ? extends T> to) Convenience method for converting this type usingConverter.of(Class, Class, Function, Function)
.<U> @NotNull DataType<U>
asConvertedDataType
(Binding<? super T, U> binding) Retrieve the data type for a given binding.<U> @NotNull DataType<U>
asConvertedDataType
(Converter<? super T, U> converter) Retrieve the data type for a given converter.default <U> @NotNull DataType<U>
asConvertedDataTypeFrom
(Class<U> toType, Function<? super T, ? extends U> from) Convenience method for converting this type to a read-only type usingConverter.from(Class, Class, Function)
.default <U> @NotNull DataType<U>
asConvertedDataTypeFrom
(Function<? super T, ? extends U> from) Convenience method for converting this type to a read-only type usingConverter.from(Class, Class, Function)
.default <U> @NotNull DataType<U>
asConvertedDataTypeTo
(Class<U> toType, Function<? super U, ? extends T> to) Convenience method for converting this type to a write-only type usingConverter.to(Class, Class, Function)
.default <U> @NotNull DataType<U>
asConvertedDataTypeTo
(Function<? super U, ? extends T> to) Convenience method for converting this type to a write-only type usingConverter.to(Class, Class, Function)
.asEnumDataType
(Class<E> enumDataType) Retrieve the data type for a given enum data type.@Nullable CharacterSet
Get the character set of this data type, ornull
if there is no character set, or if the default character set applies.characterSet
(CharacterSet characterSet) Return a new data type like this, with a new character set.@Nullable Collation
Get the collation of this data type, ornull
if there is no collation, or if the default collation applies.Return a new data type like this, with a new collation.boolean
computed()
Whether this column is computed.boolean
Whether this column is computed on the client.boolean
Whether this column is computed on the client.boolean
computedOnClientStoredOn
(GeneratorStatementType statementType) Whether this column is computed on the client.boolean
Whether this column is computed on the client.boolean
Whether this column is computed on the server.Convert an arbitrary object into<T>
.T @NotNull []
Convert an arbitrary set of objects into<T>
.convert
(Collection<?> objects) Convert an arbitrary set of objects into<T>
.default_()
The expression to be applied as theDEFAULT
value for this data type.Specify an expression to be applied as theDEFAULT
value for this data type.Specify an expression to be applied as theDEFAULT
value for this data type.boolean
Get the defaultability of this data type.defaulted
(boolean defaulted) Deprecated, for removal: This API element is subject to removal in a future version.The expression to be applied as theDEFAULT
value for this data type.defaultValue
(Field<T> defaultValue) Specify an expression to be applied as theDEFAULT
value for this data type.defaultValue
(T defaultValue) Specify an expression to be applied as theDEFAULT
value for this data type.Get the computed column expression of this data type, if any.generatedAlwaysAs
(Field<T> generatedAlwaysAsValue) Set the computed column expression of this data type to a constant expression.generatedAlwaysAs
(Generator<?, ?, T> generatedAlwaysAsValue) Set the computed column expression of this data type to a dynamic expression.generatedAlwaysAs
(T generatedAlwaysAsValue) Set the computed column expression of this data type to a constant value.Get the computed column expression of this data type, if any.@NotNull QOM.GenerationLocation
Get theQOM.GenerationLocation
of the computed column expression of this data type, if any.generationLocation
(QOM.GenerationLocation generationOption) Set thegenerationLocation()
of the computed column expression.@NotNull QOM.GenerationOption
Get theQOM.GenerationOption
of the computed column expression of this data type, if any.generationOption
(QOM.GenerationOption generationOption) Set thegenerationOption()
of the computed column expression.@Nullable DataType<?>
Retrieve the Java component data type if this is an ARRAY type, ornull
, otherwise.@Nullable Class<?>
Retrieve the Java component type if this is an ARRAY type, ornull
, otherwise.Retrieve the data type for an ARRAY of this data type.Retrieve the Java type associated with ARRAYs of this data type.Get the data type binding associated with this data type.@NotNull String
Retrieve the dialect-specific type name associated with this data type used for casting.@NotNull String
getCastTypeName
(Configuration configuration) Retrieve the dialect-specific type name associated with this data type used for casting.Get the converter associated with this data type.getDataType
(Configuration configuration) The dialect-specific data type representing this data type.@Nullable SQLDialect
Retrieve the underlyingSQLDialect
.Get the defining DOMAIN type orNULL
if there is no such type.Get the nested record's record type definition, if this is aisRecord()
, or aisMultiset()
, orNULL
otherwise.@Nullable Row
getRow()
Get the nested record'sRow
definition, if this is aisRecord()
, or aisMultiset()
, orNULL
otherwise.Get the standard SQL data type of this (dialect-specific) data type if available.int
Get JDBCTypes
value.int
getSQLType
(Configuration configuration) Get the dialect-specific JDBCTypes
value.getType()
Retrieve the Java type associated with this data type.@NotNull String
Retrieve the dialect-specific type name associated with this data type.@NotNull String
getTypeName
(Configuration configuration) Retrieve the dialect-specific type name associated with this data type.boolean
Whether this data type has a length.boolean
Whether this data type has a precision.boolean
hasScale()
Whether this data type has a scale.boolean
identity()
Get the identity flag of this data type.identity
(boolean identity) Return a new data type like this, with a new identity flag.boolean
isArray()
Whether this data type is an array type.boolean
Whether this data type is an array type.boolean
isBinary()
Whether this data type is any binary type.boolean
isDate()
Whether this data type is any date type.boolean
Whether this data type is any date or time type.boolean
Whether this data type is any decimal numeric data type.boolean
Whether this data type is an embeddable type.boolean
isEnum()
Whether this data type is an enum type.boolean
isFloat()
Whether this data type is any floating point data type.boolean
Whether this data type is any integer data type.boolean
Whether this data type is any interval type.boolean
isJSON()
Whether this data type is a JSON type.boolean
isLob()
Whether this data type is best deserialised as aLOB
.boolean
Whether this data type is a nested collection type.boolean
Whether this data type is any national character data type.boolean
Whether this data type is any numeric data type.boolean
isRecord()
Whether this data type is a nested record type.boolean
Whether this data type is a spatial type.boolean
isString()
Whether this data type is any character data type.boolean
Whether this data type is any date or time type.boolean
isTime()
Whether this data type is any time type.boolean
Whether this data type is any timestamp type.boolean
Whether this data type is any timestamp type.boolean
Whether this data type is any time type.boolean
isUDT()
Whether this data type is a UDT type.boolean
isXML()
Whether this data type is an XML type.int
length()
Get the length of this data type.length
(int length) Return a new data type like this, with a new length value.boolean
Whether the precision returned bylength()
is defined.notNull()
Synonym fornullable(boolean)
, passingfalse
as an argument.null_()
Synonym fornullable(boolean)
, passingtrue
as an argument.@NotNull Nullability
Get the nullability of this data type.nullability
(Nullability nullability) Return a new data type like this, with a new nullability.boolean
nullable()
Get the nullability of this data type.nullable
(boolean nullable) Return a new data type like this, with a new nullability.int
Get the precision of this data type.precision
(int precision) Return a new data type like this, with a new precision value.precision
(int precision, int scale) Return a new data type like this, with a new precision and scale value.boolean
Whether the precision returned byprecision()
is defined.boolean
readonly()
Get the readonly attribute of this data type.readonly
(boolean readonly) Return a new data type like this, with a new readonly attribute.boolean
Get the readonly attribute of this data type, combined with other flags that influence readonly behaviour.int
scale()
Get the scale of this data type.scale
(int scale) Return a new data type like this, with a new scale value.boolean
Whether the precision returned byscale()
is defined.stored()
Set thegenerationOption()
of the computed column expression toQOM.GenerationOption.STORED
.virtual()
Set thegenerationOption()
of the computed column expression toQOM.GenerationOption.VIRTUAL
.Methods inherited from interface org.jooq.Named
$name, getComment, getCommentPart, getName, getQualifiedName, getUnqualifiedName
-
Method Details
-
getSQLDataType
Get the standard SQL data type of this (dialect-specific) data type if available. -
getDataType
The dialect-specific data type representing this data type. -
getSQLType
int getSQLType()Get JDBCTypes
value. -
getSQLType
Get the dialect-specific JDBCTypes
value. -
getBinding
Get the data type binding associated with this data type. -
getConverter
Get the converter associated with this data type. -
getType
Retrieve the Java type associated with this data type. -
getDomain
Get the defining DOMAIN type orNULL
if there is no such type. -
getRow
Get the nested record'sRow
definition, if this is aisRecord()
, or aisMultiset()
, orNULL
otherwise. -
getRecordType
Get the nested record's record type definition, if this is aisRecord()
, or aisMultiset()
, orNULL
otherwise. -
getArrayType
Retrieve the Java type associated with ARRAYs of this data type. -
getArrayDataType
Retrieve the data type for an ARRAY of this data type.Built-in data types, as well as custom data types that have a custom
getConverter()
can be translated to array data types usingConverter.forArrays()
. Data types with customgetBinding()
cannot be translated to an array data type. Use this idiom, instead:// Doesn't work DataType<UserType[]> t1 = SQLDataType.INTEGER.asConvertedDataType(binding).getArrayDataType(); // Works DataType<UserType[]> t2 = SQLDataType.INTEGER.getArrayDataType().asConvertedDataType(arrayBinding);
- Throws:
DataTypeException
- When this data type has a customgetBinding()
, which cannot be automatically translated to an arrayBinding
.
-
getArrayComponentType
Retrieve the Java component type if this is an ARRAY type, ornull
, otherwise. -
getArrayComponentDataType
Retrieve the Java component data type if this is an ARRAY type, ornull
, otherwise. -
asArrayDataType
@NotNull @Pro <A extends ArrayRecord<?>> @NotNull DataType<A> asArrayDataType(Class<A> arrayDataType) Retrieve the data type for an Oracle-style ARRAY of this data type. -
asAssociativeArrayDataType
@NotNull @Pro <A extends AssociativeArrayRecord<?,?>> @NotNull DataType<A> asAssociativeArrayDataType(Class<A> arrayDataType) Retrieve the data type for an Oracle-style associative array of this data type. -
asEnumDataType
Retrieve the data type for a given enum data type. -
asConvertedDataType
Retrieve the data type for a given converter. -
asConvertedDataType
@NotNull default <U> @NotNull DataType<U> asConvertedDataType(Class<U> toType, Function<? super T, ? extends U> from, Function<? super U, ? extends T> to) Convenience method for converting this type usingConverter.of(Class, Class, Function, Function)
. -
asConvertedDataTypeFrom
@NotNull default <U> @NotNull DataType<U> asConvertedDataTypeFrom(Class<U> toType, Function<? super T, ? extends U> from) Convenience method for converting this type to a read-only type usingConverter.from(Class, Class, Function)
. -
asConvertedDataTypeFrom
@NotNull default <U> @NotNull DataType<U> asConvertedDataTypeFrom(Function<? super T, ? extends U> from) Convenience method for converting this type to a read-only type usingConverter.from(Class, Class, Function)
.Unlike
asConvertedDataTypeFrom(Class, Function)
, this method attempts to work without an explicitClass
reference for the underlyingConverter.toType()
. There may be some edge cases where this doesn't work (e.g. when arrays are involved), in case of which, an explicit class literal should be passed. -
asConvertedDataTypeTo
@NotNull default <U> @NotNull DataType<U> asConvertedDataTypeTo(Class<U> toType, Function<? super U, ? extends T> to) Convenience method for converting this type to a write-only type usingConverter.to(Class, Class, Function)
. -
asConvertedDataTypeTo
Convenience method for converting this type to a write-only type usingConverter.to(Class, Class, Function)
.Unlike
asConvertedDataTypeTo(Class, Function)
, this method attempts to work without an explicitClass
reference for the underlyingConverter.toType()
. There may be some edge cases where this doesn't work (e.g. when arrays are involved), in case of which, an explicit class literal should be passed. -
asConvertedDataType
Retrieve the data type for a given binding. -
getTypeName
Retrieve the dialect-specific type name associated with this data type. -
getTypeName
Retrieve the dialect-specific type name associated with this data type. -
getCastTypeName
Retrieve the dialect-specific type name associated with this data type used for casting.This is useful for some dialects that have specialised type names for cast expressions. Other dialects require type-length binding when casting, (e.g. VARCHAR(32767))
-
getCastTypeName
Retrieve the dialect-specific type name associated with this data type used for casting.This is useful for some dialects that have specialised type names for cast expressions. Other dialects require type-length binding when casting, (e.g. VARCHAR(32767))
-
getDialect
Retrieve the underlyingSQLDialect
. -
convert
Convert an arbitrary object into<T>
.See
Convert#convert(Object, Class)
for details about conversion rules. Notice this does not pass through anyConfiguration.converterProvider()
.- Parameters:
object
- The object to be converted- Returns:
- The converted object
- Throws:
DataTypeException
- If conversion fails.
-
convert
Convert an arbitrary set of objects into<T>
.See
Convert#convert(Object, Class)
for details about conversion rules. Notice this does not pass through anyConfiguration.converterProvider()
.- Parameters:
objects
- The objects to be converted- Returns:
- The converted objects
- Throws:
DataTypeException
- If conversion fails.
-
convert
Convert an arbitrary set of objects into<T>
.See
Convert#convert(Object, Class)
for details about conversion rules. Notice this does not pass through anyConfiguration.converterProvider()
.- Parameters:
objects
- The objects to be converted- Returns:
- The converted objects
- Throws:
DataTypeException
- If conversion fails.
-
nullability
Return a new data type like this, with a new nullability.[#5709] A
nullable
column cannot have anidentity()
.- Parameters:
nullability
- The new nullability- Returns:
- The new data type
-
nullability
Get the nullability of this data type.- Returns:
- The nullability
-
nullable
Return a new data type like this, with a new nullability.This is the same as calling
nullability(Nullability)
with any ofNullability.NULL
orNullability.NOT_NULL
as an argument.[#5709] A
nullable
column cannot have anidentity()
.- Parameters:
nullable
- The new nullability- Returns:
- The new data type
-
nullable
boolean nullable()Get the nullability of this data type.This returns
true
by default, i.e. ifnullability()
isNullability.DEFAULT
.- Returns:
- The nullability
-
readonly
Return a new data type like this, with a new readonly attribute.This feature is implemented in commercial distributions only.
- Parameters:
readonly
- The new readonly attribute value.- Returns:
- The new data type
-
readonly
boolean readonly()Get the readonly attribute of this data type.This feature is implemented in commercial distributions only.
-
readonlyInternal
boolean readonlyInternal()Get the readonly attribute of this data type, combined with other flags that influence readonly behaviour.A column may be marked as
readonly()
for various reasons, including:- When it is marked as readonly explicitly by the code generator.
- When it is marked as readonly implicitly because it's a computed
column with
QOM.GenerationLocation.SERVER
or withQOM.GenerationLocation.CLIENT
andQOM.GenerationOption.VIRTUAL
.
Some columns are readonly for users, meaning users of the jOOQ API cannot write to them, but jOOQ, internally, may still write to those columns. Such columns may include:
- Columns that are computed with
QOM.GenerationLocation.CLIENT
andQOM.GenerationOption.STORED
- Columns used for optimistic locking
This feature is implemented in commercial distributions only.
-
computed
boolean computed()Whether this column is computed.This feature is implemented in commercial distributions only.
-
computedOnServer
boolean computedOnServer()Whether this column is computed on the server.This is true only if all of these hold true:
This feature is implemented in commercial distributions only.
-
computedOnClient
boolean computedOnClient()Whether this column is computed on the client.This is true only if all of these hold true:
This feature is implemented in commercial distributions only.
-
computedOnClientStored
boolean computedOnClientStored()Whether this column is computed on the client.This is true only if all of these hold true:
computed()
generationLocation()
==QOM.GenerationLocation.CLIENT
generationOption()
==QOM.GenerationOption.STORED
generatedAlwaysAsGenerator()
produces a generator thatGenerator.supports(GeneratorStatementType)
any ofGeneratorStatementType.INSERT
orGeneratorStatementType.UPDATE
This feature is implemented in commercial distributions only.
-
computedOnClientStoredOn
Whether this column is computed on the client.This is true only if all of these hold true:
computed()
generationLocation()
==QOM.GenerationLocation.CLIENT
generationOption()
==QOM.GenerationOption.STORED
generatedAlwaysAsGenerator()
produces a generator thatGenerator.supports(GeneratorStatementType)
the argumentstatementType
This feature is implemented in commercial distributions only.
-
computedOnClientVirtual
boolean computedOnClientVirtual()Whether this column is computed on the client.This is true only if all of these hold true:
computed()
generationLocation()
==QOM.GenerationLocation.CLIENT
generationOption()
==QOM.GenerationOption.VIRTUAL
generatedAlwaysAsGenerator()
produces a generator thatGenerator.supports(GeneratorStatementType)
the typeGeneratorStatementType.SELECT
This feature is implemented in commercial distributions only.
-
generatedAlwaysAs
@NotNull @Support({AURORA_POSTGRES,COCKROACHDB,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,MARIADB,MYSQL_5_7,ORACLE12C,POSTGRES_12,SQLSERVER}) @NotNull DataType<T> generatedAlwaysAs(T generatedAlwaysAsValue) Set the computed column expression of this data type to a constant value.This implicitly sets
readonly()
totrue
.This feature is implemented in commercial distributions only.
-
generatedAlwaysAs
@NotNull @Support({AURORA_POSTGRES,COCKROACHDB,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,MARIADB,MYSQL_5_7,ORACLE12C,POSTGRES_12,SQLSERVER}) @NotNull DataType<T> generatedAlwaysAs(Field<T> generatedAlwaysAsValue) Set the computed column expression of this data type to a constant expression.This implicitly sets
readonly()
totrue
.This feature is implemented in commercial distributions only.
-
generatedAlwaysAs
Set the computed column expression of this data type to a dynamic expression.Unlike
generatedAlwaysAs(Object)
andgeneratedAlwaysAs(Field)
, which produce a constant value or expression, this allows for generating a dynamic expression if used along withgenerationLocation()
andQOM.GenerationLocation.CLIENT
, in order to implement client side computed columns.If
generationLocation()
isQOM.GenerationLocation.SERVER
, then this does not affect generated DML statements, and will be evaluated only in DDL statements, when creating the table.This implicitly sets
readonly()
totrue
.This feature is implemented in commercial distributions only.
-
generatedAlwaysAs
Get the computed column expression of this data type, if any.This eagerly evaluates the
generatedAlwaysAsGenerator()
generator, which may not produce the same expression upon execution of a query, in casegenerationLocation()
isQOM.GenerationLocation.CLIENT
. The behaviour ofQOM.GenerationLocation.SERVER
is not affected. The method has been left unmodified for backwards compatibility with jOOQ 3.16.This feature is implemented in commercial distributions only.
-
generatedAlwaysAsGenerator
Get the computed column expression of this data type, if any.This feature is implemented in commercial distributions only.
-
stored
@NotNull @Support({AURORA_POSTGRES,COCKROACHDB,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,MARIADB,MYSQL_5_7,ORACLE12C,POSTGRES_12,SQLSERVER}) @NotNull DataType<T> stored()Set thegenerationOption()
of the computed column expression toQOM.GenerationOption.STORED
.If not supported by the dialect, this will be ignored.
This feature is implemented in commercial distributions only.
-
virtual
@NotNull @Support({AURORA_POSTGRES,COCKROACHDB,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,MARIADB,MYSQL_5_7,ORACLE12C,POSTGRES_12,SQLSERVER}) @NotNull DataType<T> virtual()Set thegenerationOption()
of the computed column expression toQOM.GenerationOption.VIRTUAL
.If not supported by the dialect, this will be ignored.
This feature is implemented in commercial distributions only.
-
generationOption
@NotNull @Support({AURORA_POSTGRES,COCKROACHDB,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,MARIADB,MYSQL_5_7,ORACLE12C,POSTGRES_12,SQLSERVER}) @NotNull DataType<T> generationOption(QOM.GenerationOption generationOption) Set thegenerationOption()
of the computed column expression.If not supported by the dialect, this will be ignored.
This feature is implemented in commercial distributions only.
-
generationOption
Get theQOM.GenerationOption
of the computed column expression of this data type, if any.This feature is implemented in commercial distributions only.
-
generationLocation
Set thegenerationLocation()
of the computed column expression.Specifies whether the
generatedAlwaysAs()
expression is computed on theQOM.GenerationLocation.SERVER
(by default) or in theQOM.GenerationLocation.CLIENT
. The latter is supported in all dialects, the former only in relevant dialects.The computation happens in
Insert
,Update
, orMerge
statements in casegenerationOption()
isQOM.GenerationOption.STORED
, or inSelect
in case thegenerationOption()
isQOM.GenerationOption.VIRTUAL
.This feature is implemented in commercial distributions only.
-
generationLocation
Get theQOM.GenerationLocation
of the computed column expression of this data type, if any.Specifies whether the
generatedAlwaysAs()
expression is computed on theQOM.GenerationLocation.SERVER
(by default) or in theQOM.GenerationLocation.CLIENT
. The latter is supported in all dialects, the former only in relevant dialects.The computation happens in
Insert
,Update
, orMerge
statements in casegenerationOption()
isQOM.GenerationOption.STORED
, or inSelect
in case thegenerationOption()
isQOM.GenerationOption.VIRTUAL
.This feature is implemented in commercial distributions only.
-
null_
Synonym fornullable(boolean)
, passingtrue
as an argument. -
notNull
Synonym fornullable(boolean)
, passingfalse
as an argument. -
collation
@NotNull @Support({AURORA_MYSQL,AURORA_POSTGRES,COCKROACHDB,HSQLDB,MARIADB,MEMSQL,MYSQL,ORACLE,POSTGRES,SQLDATAWAREHOUSE,SQLITE,SQLSERVER,YUGABYTEDB}) @NotNull DataType<T> collation(Collation collation) Return a new data type like this, with a new collation. -
collation
Get the collation of this data type, ornull
if there is no collation, or if the default collation applies. -
characterSet
@NotNull @Support({AURORA_MYSQL,MARIADB,MEMSQL,MYSQL}) @NotNull DataType<T> characterSet(CharacterSet characterSet) Return a new data type like this, with a new character set. -
characterSet
Get the character set of this data type, ornull
if there is no character set, or if the default character set applies. -
identity
@NotNull @Support({ACCESS,ASE,AURORA_MYSQL,AURORA_POSTGRES,COCKROACHDB,DB2,DERBY,EXASOL,FIREBIRD_3_0,H2,HANA,HSQLDB,INFORMIX,INGRES,MARIADB,MEMSQL,MYSQL,ORACLE,POSTGRES,REDSHIFT,SNOWFLAKE,SQLDATAWAREHOUSE,SQLITE,SQLSERVER,SYBASE,TERADATA,VERTICA,YUGABYTEDB}) @NotNull DataType<T> identity(boolean identity) Return a new data type like this, with a new identity flag.[#5709] The IDENTITY flag imposes a NOT NULL constraint, and removes all DEFAULT values.
- Parameters:
identity
- The new identity flag- Returns:
- The new data type
-
identity
boolean identity()Get the identity flag of this data type.- Returns:
- The identity flag.
-
defaultValue
@NotNull @Support({ACCESS,ASE,AURORA_MYSQL,AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,DERBY,EXASOL,FIREBIRD,H2,HANA,HSQLDB,IGNITE,INFORMIX,INGRES,MARIADB,MEMSQL,MYSQL,ORACLE,POSTGRES,REDSHIFT,SNOWFLAKE,SQLDATAWAREHOUSE,SQLITE,SQLSERVER,SYBASE,TERADATA,VERTICA,YUGABYTEDB}) @NotNull DataType<T> defaultValue(T defaultValue) Specify an expression to be applied as theDEFAULT
value for this data type.[#5709] A
defaulted
column cannot have anidentity()
.This is an alias for
default_(Object)
.- See Also:
-
defaultValue
@NotNull @Support({ACCESS,ASE,AURORA_MYSQL,AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,DERBY,EXASOL,FIREBIRD,H2,HANA,HSQLDB,IGNITE,INFORMIX,INGRES,MARIADB,MEMSQL,MYSQL,ORACLE,POSTGRES,REDSHIFT,SNOWFLAKE,SQLDATAWAREHOUSE,SQLITE,SQLSERVER,SYBASE,TERADATA,VERTICA,YUGABYTEDB}) @NotNull DataType<T> defaultValue(Field<T> defaultValue) Specify an expression to be applied as theDEFAULT
value for this data type.A default value of a data type applies to DDL statements, such as
CREATE TABLE
ALTER TABLE
The distinct types of possible
DEFAULT
expressions is defined by the underlying database. Please refer to your database manual to learn what expressions are possible.This is an alias for
default_(Field)
. -
defaultValue
The expression to be applied as theDEFAULT
value for this data type.This is an alias for
default_()
.- Returns:
- The default value if present, or
null
if no default value is specified for this data type. - See Also:
-
default_
@NotNull @Support({ACCESS,ASE,AURORA_MYSQL,AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,DERBY,EXASOL,FIREBIRD,H2,HANA,HSQLDB,IGNITE,INFORMIX,INGRES,MARIADB,MEMSQL,MYSQL,ORACLE,POSTGRES,REDSHIFT,SNOWFLAKE,SQLDATAWAREHOUSE,SQLITE,SQLSERVER,SYBASE,TERADATA,VERTICA,YUGABYTEDB}) @NotNull DataType<T> default_(T defaultValue) Specify an expression to be applied as theDEFAULT
value for this data type.[#5709] A
defaulted
column cannot have anidentity()
.- See Also:
-
default_
@NotNull @Support({ACCESS,ASE,AURORA_MYSQL,AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,DERBY,EXASOL,FIREBIRD,H2,HANA,HSQLDB,IGNITE,INFORMIX,INGRES,MARIADB,MEMSQL,MYSQL,ORACLE,POSTGRES,REDSHIFT,SNOWFLAKE,SQLDATAWAREHOUSE,SQLITE,SQLSERVER,SYBASE,TERADATA,VERTICA,YUGABYTEDB}) @NotNull DataType<T> default_(Field<T> defaultValue) Specify an expression to be applied as theDEFAULT
value for this data type.A default value of a data type applies to DDL statements, such as
CREATE TABLE
ALTER TABLE
The distinct types of possible
DEFAULT
expressions is defined by the underlying database. Please refer to your database manual to learn what expressions are possible. -
default_
The expression to be applied as theDEFAULT
value for this data type.- Returns:
- The default value if present, or
null
if no default value is specified for this data type. - See Also:
-
defaulted
@NotNull @Deprecated(forRemoval=true, since="3.8") @NotNull DataType<T> defaulted(boolean defaulted) Deprecated, for removal: This API element is subject to removal in a future version.- [#3852] - 3.8.0 - UsedefaultValue(Field)
instead.Return a new data type like this, with a new defaultability.- Parameters:
defaulted
- The new defaultability- Returns:
- The new data type
-
defaulted
boolean defaulted()Get the defaultability of this data type.- Returns:
- The defaultability
-
precision
Return a new data type like this, with a new precision value.This will have no effect if
hasPrecision()
isfalse
This is the same as calling
precision(int, int)
withscale == 0
- Parameters:
precision
- The new precision value- Returns:
- The new data type
-
precision
Return a new data type like this, with a new precision and scale value.This will have no effect if
hasPrecision()
isfalse
, or ifscale > 0
andhasScale()
isfalse
- Parameters:
precision
- The new precision valuescale
- The new scale value- Returns:
- The new data type
-
precision
int precision()Get the precision of this data type.- Returns:
- The precision of this data type
-
hasPrecision
boolean hasPrecision()Whether this data type has a precision.- Returns:
- Whether this data type has a precision
-
precisionDefined
boolean precisionDefined()Whether the precision returned byprecision()
is defined.The default precision is
0
for all data types. If a data type does not have a precision (seehasPrecision()
), or if it was initialised without precision (e.g.SQLDataType.TIMESTAMP
), then the precision is not defined. -
scale
Return a new data type like this, with a new scale value.This will have no effect if
hasScale()
isfalse
- Parameters:
scale
- The new scale value- Returns:
- The new data type
-
scale
int scale()Get the scale of this data type.- Returns:
- The scale of this data type
-
hasScale
boolean hasScale()Whether this data type has a scale.- Returns:
- Whether this data type has a scale
-
scaleDefined
boolean scaleDefined()Whether the precision returned byscale()
is defined.The default scale is
0
for all data types. If a data type does not have a scale (seehasScale()
), or if it was initialised without scale (e.g.SQLDataType.TIMESTAMP
), then the scale is not defined. -
length
Return a new data type like this, with a new length value.This will have no effect if
hasLength()
isfalse
- Parameters:
length
- The new length value- Returns:
- The new data type
-
length
int length()Get the length of this data type.- Returns:
- The length of this data type
-
hasLength
boolean hasLength()Whether this data type has a length.- Returns:
- Whether this data type has a length
-
lengthDefined
boolean lengthDefined()Whether the precision returned bylength()
is defined.The default length is
0
for all data types. If a data type does not have a length (seehasLength()
), or if it was initialised without length (e.g.SQLDataType.TIMESTAMP
), then the length is not defined. -
isNumeric
boolean isNumeric()Whether this data type is any numeric data type.This applies to any of these types:
- See Also:
-
isInteger
boolean isInteger()Whether this data type is any integer data type.This applies to any of these types:
-
isFloat
boolean isFloat()Whether this data type is any floating point data type.This applies to any of these types:
-
isDecimal
boolean isDecimal()Whether this data type is any decimal numeric data type.This applies to any of these types:
-
isString
boolean isString()Whether this data type is any character data type.This applies to any of these types:
-
isNString
boolean isNString()Whether this data type is any national character data type.This applies to any of these types:
-
isDateTime
boolean isDateTime()Whether this data type is any date or time type.This applies to any of these types.
- See Also:
-
isDate
boolean isDate()Whether this data type is any date type.This applies to any of these types.
-
isTimestamp
boolean isTimestamp()Whether this data type is any timestamp type.This applies to any of these types.
-
isTimestampWithTimeZone
boolean isTimestampWithTimeZone()Whether this data type is any timestamp type.This applies to any of these types.
-
isTime
boolean isTime()Whether this data type is any time type.This applies to any of these types.
-
isTimeWithTimeZone
boolean isTimeWithTimeZone()Whether this data type is any time type.This applies to any of these types.
-
isTemporal
boolean isTemporal()Whether this data type is any date or time type.This applies to any of these types.
-
SQLDataType.DATE
-
SQLDataType.TIME
-
SQLDataType.TIMESTAMP
-
SQLDataType.LOCALDATE
-
SQLDataType.LOCALTIME
-
SQLDataType.LOCALDATETIME
-
SQLDataType.OFFSETTIME
-
SQLDataType.OFFSETDATETIME
-
SQLDataType.INSTANT
-
YearToSecond
-
YearToMonth
-
DayToSecond
This is a combination of
isDateTime()
orisInterval()
-
-
isInterval
boolean isInterval()Whether this data type is any interval type.This applies to any of these types.
-
isBinary
boolean isBinary()Whether this data type is any binary type.This applies to any of these types.
-
isLob
boolean isLob()Whether this data type is best deserialised as aLOB
.This applies to any of these types.
-
isArray
boolean isArray()Whether this data type is an array type. -
isAssociativeArray
boolean isAssociativeArray()Whether this data type is an array type. -
isEmbeddable
boolean isEmbeddable()Whether this data type is an embeddable type. -
isUDT
boolean isUDT()Whether this data type is a UDT type. -
isRecord
boolean isRecord()Whether this data type is a nested record type.This is true for anonymous, structural nested record types constructed with
DSL.row(SelectField...)
or for nominal nested record types, such asisUDT()
orisEmbeddable()
. -
isMultiset
boolean isMultiset()Whether this data type is a nested collection type.This is true for anonymous, structural nested collection types constructed with
DSL#multiset(Select)
orDSL.multisetAgg(Field...)
. -
isEnum
boolean isEnum()Whether this data type is an enum type. -
isJSON
boolean isJSON()Whether this data type is a JSON type. -
isXML
boolean isXML()Whether this data type is an XML type. -
isSpatial
boolean isSpatial()Whether this data type is a spatial type.
-
defaultValue(Field)
instead.