1 Reply Latest reply on Sep 4, 2002 9:56 PM by David Jencks

    How to save BIG files (>32K) in HSQL Db

    Ernst Newbie

      Hello,

      Can somebody give me a few pointers on how to store files over 32K in an container managed Entity Bean? I have a CMB Entity that has a list of documents stored in a CMP field:

      public abstract class SomeEntity extends EntityBean {
      ...

      // CMP Fields
      public abstract void setDocuments(Collection docs);
      public abstract Collection getDocuments();

      ...
      // methods
      public void addDocument(SimpleDocument document) {
      try {
      java.util.HashSet documents = getDocuments();
      if (documents != null) {
      documents.add(document);
      } else {
      HashSet docs = new HashSet();
      docs.add(document);
      setDocuments(docs);
      }
      }
      catch (Exception e) {
      throw new javax.ejb.EJBException(e.getMessage());
      }
      }
      ...
      }


      public class SimpleDocument extends Object implements java.io.Serializable {

      /** Holds value of property content. */
      private byte[] content;

      /** Holds value of property name. */
      private String name;

      /** Holds value of property format. */
      private String format;

      }

      This works fine as long I don't try to add a document larger than 32KB. When I do, I get the following error
      javax.ejb.EJBException: Store failed
      Embeded Exception
      Connection is broken

      I'm guessing that the structure of the underlying tables doesn't allow for big contents. I wanna know how I can configure the deployment files so that the database accepts big contents. Any pointers would be appreciated.
      Thanks