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.

@FunctionalInterface public interface SqlTypeMapping
Strategy interface for mapping a RelationalPersistentProperty to a Database type.
Since:
3.2
Author:
Kurt Niemi, Mark Paluch
  • 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 or NUMERIC. Can be null if the strategy cannot provide a column type.
    • getRequiredColumnType

      default String getRequiredColumnType(RelationalPersistentProperty property)
      Returns the required column type for a persistent property or throws IllegalArgumentException 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 or NUMERIC. Can be null if the strategy cannot provide a column type.
      Throws:
      IllegalArgumentException - if the column type cannot be determined.
    • isNullable

      default boolean isNullable(RelationalPersistentProperty property)
      Determine whether a column is nullable.
      Parameters:
      property - the property for which nullability should be determined.
      Returns:
      whether the property is nullable.
    • and

      default SqlTypeMapping and(SqlTypeMapping other)
      Returns a composed SqlTypeMapping 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 the other 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