Package de.xima.fc.type
Class NullSafeUUID
- java.lang.Object
-
- de.xima.fc.type.NullSafeUUID
-
- All Implemented Interfaces:
org.hibernate.usertype.UserType
public class NullSafeUUID extends Object implements org.hibernate.usertype.UserType
CustomUserTypefor non-nullableUUIDs. Maps UUIDs to the SQL char type and ensures aUUIDis always set. When the UUID is null, generates a random UUID.- Author:
- XIMA MEDIA GmbH
-
-
Constructor Summary
Constructors Constructor Description NullSafeUUID()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectassemble(Serializable cached, Object owner)ObjectdeepCopy(Object value)Serializabledisassemble(Object value)booleanequals(Object x, Object y)inthashCode(Object x)booleanisMutable()ObjectnullSafeGet(ResultSet rs, String[] names, org.hibernate.engine.spi.SharedSessionContractImplementor session, Object owner)voidnullSafeSet(PreparedStatement st, Object value, int index, org.hibernate.engine.spi.SharedSessionContractImplementor session)Objectreplace(Object original, Object target, Object owner)ClassreturnedClass()int[]sqlTypes()
-
-
-
Method Detail
-
sqlTypes
public int[] sqlTypes()
- Specified by:
sqlTypesin interfaceorg.hibernate.usertype.UserType
-
returnedClass
public Class returnedClass()
- Specified by:
returnedClassin interfaceorg.hibernate.usertype.UserType
-
equals
public boolean equals(Object x, Object y) throws org.hibernate.HibernateException
- Specified by:
equalsin interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateException
-
hashCode
public int hashCode(Object x) throws org.hibernate.HibernateException
- Specified by:
hashCodein interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateException
-
nullSafeGet
public Object nullSafeGet(ResultSet rs, String[] names, org.hibernate.engine.spi.SharedSessionContractImplementor session, Object owner) throws org.hibernate.HibernateException, SQLException
- Specified by:
nullSafeGetin interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateExceptionSQLException
-
nullSafeSet
public void nullSafeSet(PreparedStatement st, Object value, int index, org.hibernate.engine.spi.SharedSessionContractImplementor session) throws org.hibernate.HibernateException, SQLException
- Specified by:
nullSafeSetin interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateExceptionSQLException
-
deepCopy
public Object deepCopy(Object value) throws org.hibernate.HibernateException
- Specified by:
deepCopyin interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateException
-
isMutable
public boolean isMutable()
- Specified by:
isMutablein interfaceorg.hibernate.usertype.UserType
-
disassemble
public Serializable disassemble(Object value) throws org.hibernate.HibernateException
- Specified by:
disassemblein interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateException
-
assemble
public Object assemble(Serializable cached, Object owner) throws org.hibernate.HibernateException
- Specified by:
assemblein interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateException
-
-