|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.vladmihalcea.hibernate.type.ImmutableType<T>
public abstract class ImmutableType<T>
Very convenient base class for implementing immutable object types using Hibernate UserType.
The ImmutableType implements the Type interface too, so you can pass all
types extending the ImmutableType to the SQLQuery.addScalar(String, Type)
method to fix the No Dialect mapping for JDBC type issues.
| Constructor Summary | |
|---|---|
protected |
ImmutableType(Class<T> clazz)
Initialization constructor taking the Class
and using the default Configuration object. |
protected |
ImmutableType(Class<T> clazz,
Configuration configuration)
Initialization constructor taking the Class and Configuration objects. |
| Method Summary | |
|---|---|
Object |
assemble(Serializable cached,
Object owner)
|
Object |
assemble(Serializable cached,
org.hibernate.engine.spi.SessionImplementor session,
Object owner)
|
void |
beforeAssemble(Serializable cached,
org.hibernate.engine.spi.SessionImplementor session)
|
int |
compare(Object x,
Object y)
|
Object |
deepCopy(Object value)
|
Object |
deepCopy(Object value,
org.hibernate.engine.spi.SessionFactoryImplementor factory)
|
org.hibernate.metamodel.relational.Size[] |
defaultSizes(org.hibernate.engine.spi.Mapping mapping)
|
org.hibernate.metamodel.relational.Size[] |
dictatedSizes(org.hibernate.engine.spi.Mapping mapping)
|
Serializable |
disassemble(Object o)
|
Serializable |
disassemble(Object value,
org.hibernate.engine.spi.SessionImplementor session,
Object owner)
|
boolean |
equals(Object x,
Object y)
|
Object |
fromXMLNode(org.dom4j.Node xml,
org.hibernate.engine.spi.Mapping factory)
|
protected abstract T |
get(ResultSet rs,
String[] names,
org.hibernate.engine.spi.SessionImplementor session,
Object owner)
Get the column value from the JDBC ResultSet. |
int |
getColumnSpan(org.hibernate.engine.spi.Mapping mapping)
|
protected Configuration |
getConfiguration()
Get the current Configuration object. |
int |
getHashCode(Object x)
|
int |
getHashCode(Object x,
org.hibernate.engine.spi.SessionFactoryImplementor factory)
|
String |
getName()
|
Class |
getReturnedClass()
|
org.hibernate.type.Type |
getSemiResolvedType(org.hibernate.engine.spi.SessionFactoryImplementor factory)
|
int |
hashCode(Object x)
|
Object |
hydrate(ResultSet rs,
String[] names,
org.hibernate.engine.spi.SessionImplementor session,
Object owner)
|
boolean |
isAnyType()
|
boolean |
isAssociationType()
|
boolean |
isCollectionType()
|
boolean |
isComponentType()
|
protected boolean |
isDirty(Object old,
Object current)
|
boolean |
isDirty(Object old,
Object current,
boolean[] checkable,
org.hibernate.engine.spi.SessionImplementor session)
|
boolean |
isDirty(Object old,
Object current,
org.hibernate.engine.spi.SessionImplementor session)
|
boolean |
isEntityType()
|
boolean |
isEqual(Object x,
Object y)
|
boolean |
isEqual(Object x,
Object y,
org.hibernate.engine.spi.SessionFactoryImplementor factory)
|
boolean |
isModified(Object dbState,
Object currentState,
boolean[] checkable,
org.hibernate.engine.spi.SessionImplementor session)
|
boolean |
isMutable()
|
boolean |
isSame(Object x,
Object y)
|
boolean |
isXMLElement()
|
Object |
nullSafeGet(ResultSet rs,
String[] names,
org.hibernate.engine.spi.SessionImplementor session,
Object owner)
|
Object |
nullSafeGet(ResultSet rs,
String name,
org.hibernate.engine.spi.SessionImplementor session,
Object owner)
|
void |
nullSafeSet(PreparedStatement st,
Object value,
int index,
boolean[] settable,
org.hibernate.engine.spi.SessionImplementor session)
|
void |
nullSafeSet(PreparedStatement st,
Object value,
int index,
org.hibernate.engine.spi.SessionImplementor session)
|
Object |
replace(Object o,
Object target,
Object owner)
|
Object |
replace(Object original,
Object target,
org.hibernate.engine.spi.SessionImplementor session,
Object owner,
Map copyCache)
|
Object |
replace(Object original,
Object target,
org.hibernate.engine.spi.SessionImplementor session,
Object owner,
Map copyCache,
org.hibernate.type.ForeignKeyDirection foreignKeyDirection)
|
Object |
resolve(Object value,
org.hibernate.engine.spi.SessionImplementor session,
Object owner)
|
Class<T> |
returnedClass()
|
Object |
semiResolve(Object value,
org.hibernate.engine.spi.SessionImplementor session,
Object owner)
|
protected abstract void |
set(PreparedStatement st,
T value,
int index,
org.hibernate.engine.spi.SessionImplementor session)
Set the column value on the provided JDBC PreparedStatement. |
void |
setToXMLNode(org.dom4j.Node node,
Object value,
org.hibernate.engine.spi.SessionFactoryImplementor factory)
|
int[] |
sqlTypes(org.hibernate.engine.spi.Mapping mapping)
|
boolean[] |
toColumnNullness(Object value,
org.hibernate.engine.spi.Mapping mapping)
|
String |
toLoggableString(Object value,
org.hibernate.engine.spi.SessionFactoryImplementor factory)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.hibernate.usertype.UserType |
|---|
sqlTypes |
| Constructor Detail |
|---|
protected ImmutableType(Class<T> clazz)
Class
and using the default Configuration object.
clazz - the entity attribute Class type to be handled
protected ImmutableType(Class<T> clazz,
Configuration configuration)
Class and Configuration objects.
clazz - the entity attribute Class type to be handledconfiguration - custom Configuration object.| Method Detail |
|---|
protected Configuration getConfiguration()
Configuration object.
Configuration object.
protected abstract T get(ResultSet rs,
String[] names,
org.hibernate.engine.spi.SessionImplementor session,
Object owner)
throws SQLException
ResultSet.
rs - JDBC ResultSetnames - database column namesession - current Hibernate Sessionowner - current Hibernate SessionFactory
SQLException - in case of failure
protected abstract void set(PreparedStatement st,
T value,
int index,
org.hibernate.engine.spi.SessionImplementor session)
throws SQLException
PreparedStatement.
st - JDBC PreparedStatementvalue - database column valueindex - database column indexsession - current Hibernate Session
SQLException - in case of failure
public Object nullSafeGet(ResultSet rs,
String[] names,
org.hibernate.engine.spi.SessionImplementor session,
Object owner)
throws SQLException
nullSafeGet in interface org.hibernate.type.TypenullSafeGet in interface org.hibernate.usertype.UserTypeSQLException
public void nullSafeSet(PreparedStatement st,
Object value,
int index,
org.hibernate.engine.spi.SessionImplementor session)
throws SQLException
nullSafeSet in interface org.hibernate.type.TypenullSafeSet in interface org.hibernate.usertype.UserTypeSQLExceptionpublic Class<T> returnedClass()
returnedClass in interface org.hibernate.usertype.UserType
public boolean equals(Object x,
Object y)
equals in interface org.hibernate.usertype.UserTypepublic int hashCode(Object x)
hashCode in interface org.hibernate.usertype.UserTypepublic Object deepCopy(Object value)
deepCopy in interface org.hibernate.usertype.UserTypepublic boolean isMutable()
isMutable in interface org.hibernate.type.TypeisMutable in interface org.hibernate.usertype.UserTypepublic Serializable disassemble(Object o)
disassemble in interface org.hibernate.usertype.UserType
public Object assemble(Serializable cached,
Object owner)
assemble in interface org.hibernate.usertype.UserType
public Object replace(Object o,
Object target,
Object owner)
replace in interface org.hibernate.usertype.UserTypepublic boolean isAssociationType()
isAssociationType in interface org.hibernate.type.Typepublic boolean isCollectionType()
isCollectionType in interface org.hibernate.type.Typepublic boolean isEntityType()
isEntityType in interface org.hibernate.type.Typepublic boolean isAnyType()
isAnyType in interface org.hibernate.type.Typepublic boolean isComponentType()
isComponentType in interface org.hibernate.type.Type
public int getColumnSpan(org.hibernate.engine.spi.Mapping mapping)
throws org.hibernate.MappingException
getColumnSpan in interface org.hibernate.type.Typeorg.hibernate.MappingException
public int[] sqlTypes(org.hibernate.engine.spi.Mapping mapping)
throws org.hibernate.MappingException
sqlTypes in interface org.hibernate.type.Typeorg.hibernate.MappingException
public org.hibernate.metamodel.relational.Size[] dictatedSizes(org.hibernate.engine.spi.Mapping mapping)
throws org.hibernate.MappingException
dictatedSizes in interface org.hibernate.type.Typeorg.hibernate.MappingException
public org.hibernate.metamodel.relational.Size[] defaultSizes(org.hibernate.engine.spi.Mapping mapping)
throws org.hibernate.MappingException
defaultSizes in interface org.hibernate.type.Typeorg.hibernate.MappingExceptionpublic Class getReturnedClass()
getReturnedClass in interface org.hibernate.type.Type
public boolean isSame(Object x,
Object y)
throws org.hibernate.HibernateException
isSame in interface org.hibernate.type.Typeorg.hibernate.HibernateException
public boolean isEqual(Object x,
Object y)
throws org.hibernate.HibernateException
isEqual in interface org.hibernate.type.Typeorg.hibernate.HibernateException
public boolean isEqual(Object x,
Object y,
org.hibernate.engine.spi.SessionFactoryImplementor factory)
throws org.hibernate.HibernateException
isEqual in interface org.hibernate.type.Typeorg.hibernate.HibernateException
public int getHashCode(Object x)
throws org.hibernate.HibernateException
getHashCode in interface org.hibernate.type.Typeorg.hibernate.HibernateException
public int getHashCode(Object x,
org.hibernate.engine.spi.SessionFactoryImplementor factory)
throws org.hibernate.HibernateException
getHashCode in interface org.hibernate.type.Typeorg.hibernate.HibernateException
public int compare(Object x,
Object y)
compare in interface org.hibernate.type.Type
public final boolean isDirty(Object old,
Object current,
org.hibernate.engine.spi.SessionImplementor session)
isDirty in interface org.hibernate.type.Type
public final boolean isDirty(Object old,
Object current,
boolean[] checkable,
org.hibernate.engine.spi.SessionImplementor session)
isDirty in interface org.hibernate.type.Type
protected final boolean isDirty(Object old,
Object current)
public boolean isModified(Object dbState,
Object currentState,
boolean[] checkable,
org.hibernate.engine.spi.SessionImplementor session)
throws org.hibernate.HibernateException
isModified in interface org.hibernate.type.Typeorg.hibernate.HibernateException
public Object nullSafeGet(ResultSet rs,
String name,
org.hibernate.engine.spi.SessionImplementor session,
Object owner)
throws org.hibernate.HibernateException,
SQLException
nullSafeGet in interface org.hibernate.type.Typeorg.hibernate.HibernateException
SQLException
public void nullSafeSet(PreparedStatement st,
Object value,
int index,
boolean[] settable,
org.hibernate.engine.spi.SessionImplementor session)
throws org.hibernate.HibernateException,
SQLException
nullSafeSet in interface org.hibernate.type.Typeorg.hibernate.HibernateException
SQLException
public String toLoggableString(Object value,
org.hibernate.engine.spi.SessionFactoryImplementor factory)
throws org.hibernate.HibernateException
toLoggableString in interface org.hibernate.type.Typeorg.hibernate.HibernateExceptionpublic String getName()
getName in interface org.hibernate.type.Type
public Object deepCopy(Object value,
org.hibernate.engine.spi.SessionFactoryImplementor factory)
throws org.hibernate.HibernateException
deepCopy in interface org.hibernate.type.Typeorg.hibernate.HibernateException
public Serializable disassemble(Object value,
org.hibernate.engine.spi.SessionImplementor session,
Object owner)
throws org.hibernate.HibernateException
disassemble in interface org.hibernate.type.Typeorg.hibernate.HibernateException
public Object assemble(Serializable cached,
org.hibernate.engine.spi.SessionImplementor session,
Object owner)
throws org.hibernate.HibernateException
assemble in interface org.hibernate.type.Typeorg.hibernate.HibernateException
public void beforeAssemble(Serializable cached,
org.hibernate.engine.spi.SessionImplementor session)
beforeAssemble in interface org.hibernate.type.Type
public Object hydrate(ResultSet rs,
String[] names,
org.hibernate.engine.spi.SessionImplementor session,
Object owner)
throws org.hibernate.HibernateException,
SQLException
hydrate in interface org.hibernate.type.Typeorg.hibernate.HibernateException
SQLException
public Object resolve(Object value,
org.hibernate.engine.spi.SessionImplementor session,
Object owner)
throws org.hibernate.HibernateException
resolve in interface org.hibernate.type.Typeorg.hibernate.HibernateException
public Object semiResolve(Object value,
org.hibernate.engine.spi.SessionImplementor session,
Object owner)
throws org.hibernate.HibernateException
semiResolve in interface org.hibernate.type.Typeorg.hibernate.HibernateExceptionpublic org.hibernate.type.Type getSemiResolvedType(org.hibernate.engine.spi.SessionFactoryImplementor factory)
getSemiResolvedType in interface org.hibernate.type.Type
public Object replace(Object original,
Object target,
org.hibernate.engine.spi.SessionImplementor session,
Object owner,
Map copyCache)
throws org.hibernate.HibernateException
replace in interface org.hibernate.type.Typeorg.hibernate.HibernateException
public Object replace(Object original,
Object target,
org.hibernate.engine.spi.SessionImplementor session,
Object owner,
Map copyCache,
org.hibernate.type.ForeignKeyDirection foreignKeyDirection)
throws org.hibernate.HibernateException
replace in interface org.hibernate.type.Typeorg.hibernate.HibernateException
public boolean[] toColumnNullness(Object value,
org.hibernate.engine.spi.Mapping mapping)
toColumnNullness in interface org.hibernate.type.Typepublic boolean isXMLElement()
isXMLElement in interface org.hibernate.type.Type
public void setToXMLNode(org.dom4j.Node node,
Object value,
org.hibernate.engine.spi.SessionFactoryImplementor factory)
throws org.hibernate.HibernateException
setToXMLNode in interface org.hibernate.type.Typeorg.hibernate.HibernateException
public Object fromXMLNode(org.dom4j.Node xml,
org.hibernate.engine.spi.Mapping factory)
throws org.hibernate.HibernateException
fromXMLNode in interface org.hibernate.type.Typeorg.hibernate.HibernateException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||