@@ -0,0 +1,2197 @@
+package br.com.smallbi.util;%0A%0Aimport java.io.Serializable;%0Aimport java.sql.PreparedStatement;%0Aimport java.sql.ResultSet;%0Aimport java.sql.SQLException;%0Aimport java.sql.Types;%0Aimport org.hibernate.HibernateException;%0A %0A/**%0A * Store and retrieve a PostgreSQL %22xml%22 column as a Java string.%0A */%0Apublic class SQLXMLType implements org.hibernate.usertype.UserType %7B%0A %0A    private final int%5B%5D sqlTypesSupported = new int%5B%5D %7B Types.VARCHAR %7D;%0A %0A    @Override%0A    public int%5B%5D sqlTypes() %7B%0A        return sqlTypesSupported;%0A    %7D%0A %0A    @Override%0A    public Class returnedClass() %7B%0A        return String.class;%0A    %7D%0A %0A    @Override%0A    public boolean equals(Object x, Object y) throws HibernateException %7B%0A        if (x == null) %7B%0A            return y == null;%0A        %7D else %7B%0A            return x.equals(y);%0A        %7D%0A    %7D%0A %0A    @Override%0A    public int hashCode(Object x) throws HibernateException %7B%0A        return x == null ? null : x.hashCode();%0A    %7D%0A %0A    @Override%0A    public Object nullSafeGet(ResultSet rs, String%5B%5D names, Object owner) throws HibernateException, SQLException %7B%0A        assert(names.length == 1);%0A        String xmldoc = rs.getString( names%5B0%5D );%0A        return rs.wasNull() ? null : xmldoc;%0A    %7D%0A %0A    @Override%0A    public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException %7B%0A        if (value == null) %7B%0A            st.setNull(index, Types.OTHER);%0A        %7D else %7B%0A            st.setObject(index, value, Types.OTHER);%0A        %7D%0A    %7D%0A %0A    @Override%0A    public Object deepCopy(Object value) throws HibernateException %7B%0A        if (value == null)%0A            return null;%0A        return new String( (String)value );%0A    %7D%0A %0A    @Override%0A    public boolean isMutable() %7B%0A        return false;%0A    %7D%0A %0A    @Override%0A    public Serializable disassemble(Object value) throws HibernateException %7B%0A        return (String) value;%0A    %7D%0A %0A    @Override%0A    public Object assemble(Serializable cached, Object owner) throws HibernateException %7B%0A        return (String) cached;%0A    %7D%0A %0A    @Override%0A    public Object replace(Object original, Object target, Object owner) throws HibernateException %7B%0A        return original;%0A    %7D%0A%7D%0A

Ajuste para inserção do datatype xml