I need use BFile like storage type for my files. I read all of posts in this forum about BFile. But I can not solve this exception:
Caused by: org.hibernate.MappingException: Could not determine type for: bfile, for columns: [org.hibernate.mapping.Column(file)]
my class:
Code:
@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;
    }
my user type:Code:
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;
    }
}
what I am doing wrong?
configuration:
hibernate 3.2.5
Oracle Database 11g[/code][/b]