Hi there !
I am trying to implement the UserType class in order to deal with Oracle BFiles.
Could someone help me, because I have no idea how to correctly implements the following methods :
Code:
public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException;
public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException;
public Object deepCopy(Object value) throws HibernateException;
Thank u
PS : The rest of the class looks like this :
Code:
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import oracle.jdbc.driver.OracleTypes;
import oracle.sql.BFILE;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.UserType;
public final class BFileType implements UserType {
private static final int BFILE_TYPE = OracleTypes.BFILE;
private static final Class RETURNED_CLASS = BFILE.class;
public int[] sqlTypes() {
return new int[]{BFILE_TYPE};
}
public Class returnedClass() {
return RETURNED_CLASS;
}
public boolean equals(Object x, Object y) throws HibernateException {
BFILE bx = (BFILE)x;
BFILE by = (BFILE)y;
if (bx == by){
return true;
}
if (bx == null || by == null){
return false;
}
return bx.equals(by);
}
public boolean isMutable() {
return false;
}
}
Code: