Zdravím, mohl by prosím někdo poradit, jak v Hibernate pracovat s Oracle typem 
BFile? Podle toho co jsem vyčetl z hibenetího fóra, jsem vyzkoušel toto:

předek mojí entitní třídy:

@TypeDef(name = "bfile", typeClass = BFileType.class)
abstract public class GeneralFile extends BaseWithId {

    private String name;
    private String description;

    private byte[] file;
    ...

    @Type(type = "bfile")
    byte[] getFile() {
        return file;
    }

můj user type:

import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import oracle.jdbc.OracleConnection;
import oracle.jdbc.OracleTypes;
import oracle.sql.BFILE;

import org.hibernate.HibernateException;
import org.hibernate.usertype.UserType;
import org.hibernate.util.EqualsHelper;

public final class BFileType implements UserType {
    private static final int BFILE_TYPE = OracleTypes.BFILE;
    private static final Class RETURNED_CLASS = byte[].class;

    public int[] sqlTypes() {
        return new int[] { BFILE_TYPE };
    }

    public Class returnedClass() {
        return RETURNED_CLASS;
    }

    public boolean equals(Object x, Object y) throws HibernateException {
        return EqualsHelper.equals(x, y);
    }

    public boolean isMutable() {
        return false;
    }

    public Object assemble(Serializable cached, Object owner) throws 
HibernateException {
        return cached;
    }

    public Object deepCopy(Object value) throws HibernateException {
        return value;
    }

    public Serializable disassemble(Object value) throws HibernateException {
        return (Serializable) value;
    }

    public int hashCode(Object x) throws HibernateException {
        return x.hashCode();
    }

    public Object nullSafeGet(ResultSet rs, String[] names, Object owner)
            throws HibernateException, SQLException {
        BFILE file = (BFILE) rs.getObject(names[0]);

        if (file == null) {
            return null;
        }

        return file.getBytes();
    }

    public void nullSafeSet(PreparedStatement st, Object value, int index)
            throws HibernateException, SQLException {
        if (value == null) {
            st.setObject(index, null);
        } else {
            BFILE file = new BFILE((OracleConnection) st.getConnection(), 
(byte[]) value);
            file.setLocator("".getBytes());
            st.setObject(index, file);
        }
    }

    public Object replace(Object original, Object target, Object owner) throws 
HibernateException {
        return original;
    }
}

Ovšem toto řešení končí na výjimce:

org.hibernate.MappingException: Could not determine type for: bfile, for 
columns: [org.hibernate.mapping.Column(file)]


Odpovedet emailem