Class PostgreSQLRangeType
java.lang.Object
io.hypersistence.utils.hibernate.type.ImmutableType<Range>
io.hypersistence.utils.hibernate.type.range.PostgreSQLRangeType
- All Implemented Interfaces:
Serializable,org.hibernate.type.Type,org.hibernate.usertype.DynamicParameterizedType,org.hibernate.usertype.EnhancedUserType<Range>,org.hibernate.usertype.ParameterizedType,org.hibernate.usertype.UserType<Range>
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:
- int4range
- int8range
- numrange
- tsrange
- tstzrange
- daterange
For more details about how to use it, check out this article on vladmihalcea.com.
- Author:
- Edgar Asatryan, Vlad Mihalcea
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.hibernate.usertype.DynamicParameterizedType
org.hibernate.usertype.DynamicParameterizedType.ParameterType -
Field Summary
FieldsFields inherited from interface org.hibernate.usertype.DynamicParameterizedType
ACCESS_TYPE, ENTITY, IS_DYNAMIC, IS_PRIMARY_KEY, PARAMETER_TYPE, PROPERTY, RETURNED_CLASS, XPROPERTY -
Constructor Summary
ConstructorsConstructorDescriptionPostgreSQLRangeType(org.hibernate.type.spi.TypeBootstrapContext typeBootstrapContext) -
Method Summary
Modifier and TypeMethodDescriptionfromStringValue(CharSequence sequence) protected Rangeget(ResultSet rs, int position, org.hibernate.engine.spi.SharedSessionContractImplementor session, Object owner) Get the column value from the JDBCResultSet.Class<?>intprotected voidset(PreparedStatement st, Range range, int index, org.hibernate.engine.spi.SharedSessionContractImplementor session) Set the column value on the provided JDBCPreparedStatement.voidsetParameterValues(Properties parameters) Methods inherited from class io.hypersistence.utils.hibernate.type.ImmutableType
assemble, assemble, beforeAssemble, compare, compare, deepCopy, deepCopy, disassemble, disassemble, equals, getColumnSpan, getConfiguration, getHashCode, getHashCode, getName, getReturnedClass, getSqlTypeCodes, hashCode, isAnyType, isAssociationType, isCollectionType, isComponentType, isDirty, isDirty, isDirty, isEntityType, isEqual, isEqual, isModified, isMutable, isSame, nullSafeGet, nullSafeSet, nullSafeSet, replace, replace, replace, returnedClass, toColumnNullness, toLoggableString, toSqlLiteral, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.type.Type
disassemble, getReturnedClassName, getTypeForEqualsHashCodeMethods inherited from interface org.hibernate.usertype.UserType
getDefaultSqlLength, getDefaultSqlPrecision, getDefaultSqlScale, getJdbcType, getValueConverter
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
PostgreSQLRangeType
public PostgreSQLRangeType() -
PostgreSQLRangeType
public PostgreSQLRangeType(org.hibernate.type.spi.TypeBootstrapContext typeBootstrapContext)
-
-
Method Details
-
getSqlType
public int getSqlType()- Specified by:
getSqlTypein interfaceorg.hibernate.usertype.UserType<Range>
-
setParameterValues
- Specified by:
setParameterValuesin interfaceorg.hibernate.usertype.ParameterizedType
-
getElementType
-
fromStringValue
- Specified by:
fromStringValuein interfaceorg.hibernate.usertype.EnhancedUserType<Range>- Throws:
org.hibernate.HibernateException
-