: A type that maps an SQL VARBINARY to a
serializable Java object.
| Method from org.hibernate.type.SerializableType Detail: |
public Object assemble(Serializable cached,
SessionImplementor session,
Object owner) throws HibernateException {
return (cached==null) ? null : fromBytes( (byte[]) cached );
}
|
public Object deepCopyNotNull(Object value) throws HibernateException {
return fromBytes( toBytes(value) );
}
|
public Serializable disassemble(Object value,
SessionImplementor session,
Object owner) throws HibernateException {
return (value==null) ? null : toBytes(value);
}
|
public Object fromStringValue(String xml) throws HibernateException {
return fromBytes( (byte[]) Hibernate.BINARY.fromStringValue(xml) );
}
|
public Object get(ResultSet rs,
String name) throws HibernateException, SQLException {
byte[] bytes = (byte[]) Hibernate.BINARY.get(rs, name);
// Some JDBC drivers erroneously return an empty array here for a null DB value :/
if ( bytes == null || bytes.length == 0 ) {
return null;
}
else {
return fromBytes(bytes);
}
}
|
public int getHashCode(Object x,
EntityMode entityMode) {
return Hibernate.BINARY.getHashCode( toBytes(x), entityMode );
}
|
public String getName() {
return (serializableClass==Serializable.class) ? "serializable" : serializableClass.getName();
}
|
public Class getReturnedClass() {
return serializableClass;
}
|
public boolean isEqual(Object x,
Object y) throws HibernateException {
if ( x == y ) {
return true;
}
if ( x == null || y == null ) {
return false;
}
return x.equals( y ) || Hibernate.BINARY.isEqual( toBytes( x ), toBytes( y ) );
}
|
public void set(PreparedStatement st,
Object value,
int index) throws HibernateException, SQLException {
Hibernate.BINARY.set(st, toBytes(value), index);
}
|
public int sqlType() {
return Hibernate.BINARY.sqlType();
}
|
public String toString(Object value) throws HibernateException {
return Hibernate.BINARY.toString( toBytes(value) );
}
|