Hi all,
I store attachments file (like jpg, bmp, doc, pdf) inside a db table (postgresql db, column type is BYTEA).
Insert is performed via a Stateful SessionBean that uses an Entity Bean.
(at Entity Level the db column is mapped using the generic Object class).
Insert is ok.
When I try to read the attachments I use a Stateless SessioBean
that calls a DAO Class (inside DAO Class, JDBC code:
"select column from table ...." then I apply resulSet.getObject()
method).
Reading is ok.
But when I try to remove the attachment (EntityBean remove() method)
I get a strange exception.
ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackLocalException in method: public abstract void javax.ejb.EJBLocalObject.remove() throws javax.ejb.RemoveException,javax.ejb.EJBException, causedBy: java.sql.SQLException: Unable to load to deserialize result: java.io.StreamCorruptedException: invalid stream header
I changed java type from Object to byte[]
and everything (insert, select, remove) seems to be ok
(I hope ;-)).
Moreno