hi all.
I'm new to hibernate and I tried to implement hibernate in my application. Everything works fine but I can't handle the InpustStream from jpeg files. Previously, I did it directly through the JDBC driver from MySQL (mysql-connector-java-3.0.15-ga-bin.jar) which works fine. I was able to store and read the files without any errors.
I'm using middlegen to generate my hbm.xml mappings files. The relevant code is right below. The property settings are advised from middlegen.
Code:
<property
name="transferdata"
type="java.io.InputStream"
column="TRANSFERDATA"
not-null="true"
length="2147483647"
/>
Afterwards I'm using extension tools form hibernate (hbm2java) to generate my java class.
Code:
public class MediaTransfer implements Serializable {
public InputStream getTransferdata() {
return this.transferdata;
}
public void setTransferdata(InputStream transferdata) {
this.transferdata = transferdata;
}
my hibernate.cfg.xml
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.datasource">java:DEV.MEDIAMANAGEMENTSERVICE</property>
<property name="show_sql">false</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.cache.provider_class">net.sf.ehcache.hibernate.Provider</property>
<!-- Mapping files -->
<mapping resource="ch/asiva/ch/mediamanagement/internal/vo/hibernate/MediaTransfer.hbm.xml"/>
</session-factory>
</hibernate-configuration>
when I tried to read or store data to that table, this exception occurs.
Code:
Caused by: net.sf.hibernate.MappingException: Could not interpret type: java.io.InputStream
I haven't found much on the about this topic and I wasn't able to get properly into hibernate now.
But I would really appreciate any information, help or solutions about this exception.
thanks.