com.vladmihalcea.hibernate.type.range
Class PostgreSQLRangeType

java.lang.Object
  extended by com.vladmihalcea.hibernate.type.ImmutableType<Range>
      extended by com.vladmihalcea.hibernate.type.range.PostgreSQLRangeType
All Implemented Interfaces:
Serializable, org.hibernate.type.Type, org.hibernate.usertype.DynamicParameterizedType, org.hibernate.usertype.ParameterizedType, org.hibernate.usertype.UserType

public class PostgreSQLRangeType
extends ImmutableType<Range>
implements org.hibernate.usertype.DynamicParameterizedType

Maps a Range object type to a PostgreSQL range column type.

Supported range types:

For more details about how to use it, check out this article on vladmihalcea.com.

Author:
Edgar Asatryan, Vlad Mihalcea
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.hibernate.usertype.DynamicParameterizedType
org.hibernate.usertype.DynamicParameterizedType.ParameterType
 
Field Summary
static PostgreSQLRangeType INSTANCE
           
 
Fields inherited from interface org.hibernate.usertype.DynamicParameterizedType
ACCESS_TYPE, ENTITY, IS_DYNAMIC, IS_PRIMARY_KEY, PARAMETER_TYPE, PROPERTY, RETURNED_CLASS, XPROPERTY
 
Constructor Summary
PostgreSQLRangeType()
           
 
Method Summary
protected  Range get(ResultSet rs, String[] names, org.hibernate.engine.spi.SessionImplementor session, Object owner)
          Get the column value from the JDBC ResultSet.
 Class<?> getElementType()
           
protected  void set(PreparedStatement st, Range range, int index, org.hibernate.engine.spi.SessionImplementor session)
          Set the column value on the provided JDBC PreparedStatement.
 void setParameterValues(Properties parameters)
           
 int[] sqlTypes()
           
 
Methods inherited from class com.vladmihalcea.hibernate.type.ImmutableType
assemble, assemble, beforeAssemble, compare, deepCopy, deepCopy, defaultSizes, dictatedSizes, disassemble, disassemble, equals, getColumnSpan, getConfiguration, getHashCode, getHashCode, getName, getReturnedClass, getSemiResolvedType, hashCode, hydrate, isAnyType, isAssociationType, isCollectionType, isComponentType, isDirty, isDirty, isDirty, isEntityType, isEqual, isEqual, isModified, isMutable, isSame, nullSafeGet, nullSafeGet, nullSafeSet, nullSafeSet, replace, replace, replace, resolve, returnedClass, semiResolve, sqlTypes, toColumnNullness, toLoggableString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final PostgreSQLRangeType INSTANCE
Constructor Detail

PostgreSQLRangeType

public PostgreSQLRangeType()
Method Detail

sqlTypes

public int[] sqlTypes()
Specified by:
sqlTypes in interface org.hibernate.usertype.UserType

get

protected Range get(ResultSet rs,
                    String[] names,
                    org.hibernate.engine.spi.SessionImplementor session,
                    Object owner)
             throws SQLException
Description copied from class: ImmutableType
Get the column value from the JDBC ResultSet.

Specified by:
get in class ImmutableType<Range>
Parameters:
rs - JDBC ResultSet
names - database column name
session - current Hibernate Session
owner - current Hibernate SessionFactory
Returns:
column value
Throws:
SQLException - in case of failure

set

protected void set(PreparedStatement st,
                   Range range,
                   int index,
                   org.hibernate.engine.spi.SessionImplementor session)
            throws SQLException
Description copied from class: ImmutableType
Set the column value on the provided JDBC PreparedStatement.

Specified by:
set in class ImmutableType<Range>
Parameters:
st - JDBC PreparedStatement
range - database column value
index - database column index
session - current Hibernate Session
Throws:
SQLException - in case of failure

setParameterValues

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

getElementType

public Class<?> getElementType()


Copyright © 2021. All rights reserved.