yes i have tried :
Code:
<property name="file" type="blob" column="FILE" />
but i still get this exception:
Code:
java.lang.ClassCastException: [B cannot be cast to java.sql.Blob
here is how my fileObject class looks like:
Code:
package com.kc.models;
public class FileObject {
private String fileName;
private String type;
private double size;
private byte[] file;
private int id;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public double getSize() {
return size;
}
public void setSize(double size) {
this.size = size;
}
public byte[] getFile() {
return file;
}
public void setFile(byte[] file) {
this.file = file;
}
}
And here is my fileObject.hbm.xml file:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.kc.models.FileObject" >
<class name="com.kc.models.FileObject" table="FILES">
<id name="id" column="ID">
<generator class="native" />
</id>
<property name="fileName" type="string" column="FILENAME" />
<property name="type" type="string" column="TYPE" />
<property name="size" type="double" column="SIZE" />
<property name="file" type="blob" column="FILE" />
</class>
</hibernate-mapping>
O and here is a print screen of mySql: