Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:2
Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping package="em">
<class name="PieceJointe" proxy="PieceJointe" lazy="true">
<id name="idPJ">
<generator class="sequence">
<param name="sequence">seq_PieceJointe</param>
</generator>
</id>
<property name="legende" type="string"/>
<property name="origine" type="string"/>
<property name="vignetteBD" type="blob"/>
<property name="imageBD" type="blob"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Full stack trace of any exception that occurs:Code:
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
caused by class java.lang.ClassCastException
at net.sf.hibernate.type.BlobType.set(BlobType.java:27)
at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.java:48)
at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.java:35)
at net.sf.hibernate.persister.EntityPersister.dehydrate(EntityPersister.java:393)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:466)
Name and version of the database you are using:Oracle 9iThe generated SQL (show_sql=true):Code:
create table PieceJointe (
idPJ number(19,0) not null,
legende varchar2(255),
origine varchar2(255),
vignetteBD blob,
imageBD blob)
primary key (idPJ)
)
Debug level Hibernate log excerpt:Hello I try to upload a file from a jsp. I map it with struts as a FormFile. then in my class I transform the file into a java.sql.blob.
is there a simple way to put a file into a blob in database? is there an example?
thanx a lot[/code]