Class PostgreSQLSpringRangeType

java.lang.Object
io.hypersistence.utils.hibernate.type.ImmutableType<org.springframework.data.domain.Range>
io.hypersistence.utils.hibernate.type.range.spring.PostgreSQLSpringRangeType
All Implemented Interfaces:
Serializable, org.hibernate.type.Type, org.hibernate.usertype.DynamicParameterizedType, org.hibernate.usertype.EnhancedUserType<org.springframework.data.domain.Range>, org.hibernate.usertype.ParameterizedType, org.hibernate.usertype.UserType<org.springframework.data.domain.Range>

public class PostgreSQLSpringRangeType extends ImmutableType<org.springframework.data.domain.Range> implements org.hibernate.usertype.DynamicParameterizedType
See Also:
  • Field Details

  • Constructor Details

    • PostgreSQLSpringRangeType

      public PostgreSQLSpringRangeType()
    • PostgreSQLSpringRangeType

      public PostgreSQLSpringRangeType(Class<?> elementType)
  • Method Details

    • get

      protected org.springframework.data.domain.Range get(ResultSet rs, int position, org.hibernate.engine.spi.SharedSessionContractImplementor session, Object owner) throws SQLException
      Description copied from class: ImmutableType
      Get the column value from the JDBC ResultSet.
      Specified by:
      get in class ImmutableType<org.springframework.data.domain.Range>
      Parameters:
      rs - JDBC ResultSet
      position - database column position
      session - current Hibernate Session
      owner - current Hibernate SessionFactoryImplementor
      Returns:
      column value
      Throws:
      SQLException - in case of failure
    • set

      protected void set(PreparedStatement st, org.springframework.data.domain.Range range, int index, org.hibernate.engine.spi.SharedSessionContractImplementor session) throws SQLException
      Description copied from class: ImmutableType
      Set the column value on the provided JDBC PreparedStatement.
      Specified by:
      set in class ImmutableType<org.springframework.data.domain.Range>
      Parameters:
      st - JDBC PreparedStatement
      range - database column value
      index - database column index
      session - current Hibernate Session
      Throws:
      SQLException - in case of failure
    • fromStringValue

      public org.springframework.data.domain.Range fromStringValue(CharSequence sequence) throws org.hibernate.HibernateException
      Specified by:
      fromStringValue in interface org.hibernate.usertype.EnhancedUserType<org.springframework.data.domain.Range>
      Throws:
      org.hibernate.HibernateException
    • setParameterValues

      public void setParameterValues(Properties properties)
      Specified by:
      setParameterValues in interface org.hibernate.usertype.ParameterizedType
    • getSqlType

      public int getSqlType()
      Specified by:
      getSqlType in interface org.hibernate.usertype.UserType<org.springframework.data.domain.Range>
    • ofString

      public static <T extends Comparable<?>> org.springframework.data.domain.Range<T> ofString(String str, Function<String,T> converter, Class<T> clazz)
    • bigDecimalRange

      public static org.springframework.data.domain.Range<BigDecimal> bigDecimalRange(String range)
    • integerRange

      public static org.springframework.data.domain.Range<Integer> integerRange(String range)
    • longRange

      public static org.springframework.data.domain.Range<Long> longRange(String range)
    • localDateTimeRange

      public static org.springframework.data.domain.Range<LocalDateTime> localDateTimeRange(String range)
    • localDateRange

      public static org.springframework.data.domain.Range<LocalDate> localDateRange(String range)
    • zonedDateTimeRange

      public static org.springframework.data.domain.Range<ZonedDateTime> zonedDateTimeRange(String rangeStr)
    • offsetDateTimeRange

      public static org.springframework.data.domain.Range<OffsetDateTime> offsetDateTimeRange(String rangeStr)