I read the Wiki article at
http://www.hibernate.org/56.html
and modified the code accordingly. Here is the code snippet
hibernate.cfg.xml file
Code:
<property
name="attachmentContent"
type="java.sql.Blob"
column="ATTACHMENT_CONTENT"
not-null="false"
/>
Calling Code:
Code:
File file = new File(FILE_NAME);
FileInputStream in = new FileInputStream(file);
attament.setAttachmentContent(Hibernate.createBlob(in));
But I get the following error
Code:
ERROR [Jun 01 2004 03:05:51 PM] [JDBCExceptionReporter] (logExceptions) - No more data to read from socket
ERROR [Jun 01 2004 03:05:52 PM] [JDBCExceptionReporter] (logExceptions) - No more data to read from socket
ERROR [Jun 01 2004 03:05:52 PM] [JDBCExceptionReporter] (logExceptions) - No more data to read from socket
ERROR [Jun 01 2004 03:05:52 PM] [JDBCException] (<init>) - could not insert: [org.ifmc.email.EmailAttachment#1]
java.sql.SQLException: No more data to read from socket
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:1160)
at oracle.jdbc.ttc7.MAREngine.unmarshalUB1(MAREngine.java:963)
at oracle.jdbc.ttc7.MAREngine.unmarshalSB1(MAREngine.java:893)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:375)
If I use the file less than 4000, it works fine as expected. I use Oracle 9.X.
Thanks for your help
Osoe