1 Reply Latest reply on Feb 19, 2007 9:25 AM by morenito9000

    Unable to load to deserialize result

    morenito9000

      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 think it's something related to serialization.
      Object class is not the proper class I must use to map a BYTEA DB column ?

      I use JBOSS 3.2.3 and Postgesql 7.4.5.

      Any help is very very appreciated.
      Thank you for your help.

      Ciao
      Moreno