85 lines
2.6 KiB
Java
85 lines
2.6 KiB
Java
//package types;
|
|
//
|
|
//import java.io.Serializable;
|
|
//import java.sql.PreparedStatement;
|
|
//import java.sql.ResultSet;
|
|
//import java.sql.SQLException;
|
|
//import java.sql.Types;
|
|
//import org.hibernate.HibernateException;
|
|
//import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
|
//
|
|
///**
|
|
// * Store and retrieve a PostgreSQL "xml" column as a Java string.
|
|
// */
|
|
//public class SQLXMLType implements org.hibernate.usertype.UserType {
|
|
//
|
|
// private final int[] sqlTypesSupported = new int[] { Types.VARCHAR };
|
|
//
|
|
// public int[] sqlTypes() {
|
|
// return sqlTypesSupported;
|
|
// }
|
|
//
|
|
// public Class returnedClass() {
|
|
// return String.class;
|
|
// }
|
|
//
|
|
// public boolean equals(Object x, Object y) throws HibernateException {
|
|
// if (x == null) {
|
|
// return y == null;
|
|
// } else {
|
|
// return x.equals(y);
|
|
// }
|
|
// }
|
|
//
|
|
// public int hashCode(Object x) throws HibernateException {
|
|
// return x == null ? null : x.hashCode();
|
|
// }
|
|
//
|
|
// public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException {
|
|
// assert(names.length == 1);
|
|
// String xmldoc = rs.getString( names[0] );
|
|
// return rs.wasNull() ? null : xmldoc;
|
|
// }
|
|
//
|
|
// public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
|
|
// if (value == null) {
|
|
// st.setNull(index, Types.OTHER);
|
|
// } else {
|
|
// st.setObject(index, value, Types.OTHER);
|
|
// }
|
|
// }
|
|
//
|
|
// public Object deepCopy(Object value) throws HibernateException {
|
|
// if (value == null)
|
|
// return null;
|
|
// return new String( (String)value );
|
|
// }
|
|
//
|
|
// public boolean isMutable() {
|
|
// return false;
|
|
// }
|
|
//
|
|
// public Serializable disassemble(Object value) throws HibernateException {
|
|
// return (String) value;
|
|
// }
|
|
//
|
|
// public Object assemble(Serializable cached, Object owner) throws HibernateException {
|
|
// return (String) cached;
|
|
// }
|
|
//
|
|
// public Object replace(Object original, Object target, Object owner) throws HibernateException {
|
|
// return original;
|
|
// }
|
|
//
|
|
// public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)
|
|
// throws HibernateException, SQLException {
|
|
// // TODO Auto-generated method stub
|
|
// return null;
|
|
// }
|
|
//
|
|
// public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session)
|
|
// throws HibernateException, SQLException {
|
|
// // TODO Auto-generated method stub
|
|
//
|
|
// }
|
|
//} |