Interface SqlTypeMapping
- All Known Implementing Classes:
DefaultSqlTypeMapping
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Strategy interface for mapping a
RelationalPersistentProperty
to a Database type.- Since:
- 3.2
- Author:
- Kurt Niemi, Mark Paluch, Evgenii Koba, Jens Schauder
-
Method Summary
Modifier and TypeMethodDescriptiondefault SqlTypeMapping
and
(SqlTypeMapping other) Returns a composedSqlTypeMapping
that represents a fallback of this type mapping and another.default String
getColumnType
(Class<?> type) Determines a column type for Class.getColumnType
(RelationalPersistentProperty property) Determines a column type for a persistent property.default String
Returns the required column type for a persistent property or throwsIllegalArgumentException
if the type cannot be determined.default boolean
isNullable
(RelationalPersistentProperty property) Determine whether a column is nullable.
-
Method Details
-
getColumnType
Determines a column type for a persistent property.- Parameters:
property
- the property for which the type should be determined.- Returns:
- the SQL type to use, such as
VARCHAR
orNUMERIC
. Can be null if the strategy cannot provide a column type.
-
getColumnType
Determines a column type for Class.- Parameters:
type
- class for which the type should be determined.- Returns:
- the SQL type to use, such as
VARCHAR
orNUMERIC
. Can be null if the strategy cannot provide a column type. - Since:
- 3.3
-
getRequiredColumnType
Returns the required column type for a persistent property or throwsIllegalArgumentException
if the type cannot be determined.- Parameters:
property
- the property for which the type should be determined.- Returns:
- the SQL type to use, such as
VARCHAR
orNUMERIC
. Can be null if the strategy cannot provide a column type. - Throws:
IllegalArgumentException
- if the column type cannot be determined.
-
isNullable
Determine whether a column is nullable.- Parameters:
property
- the property for which nullability should be determined.- Returns:
- whether the property is nullable.
-
and
Returns a composedSqlTypeMapping
that represents a fallback of this type mapping and another. When evaluating the composed predicate, if this mapping does not contain a column mapping (i.e.getColumnType(RelationalPersistentProperty)
returnsnull), then theother
mapping is evaluated.Any exceptions thrown during evaluation of either type mapping are relayed to the caller; if evaluation of this type mapping throws an exception, the
other
predicate will not be evaluated.- Parameters:
other
- a type mapping that will be used as fallback, must not be null.- Returns:
- a composed type mapping
-