1 Reply Latest reply on Dec 28, 2006 1:33 PM by lafr

    Store pdf files in the database

    sigitm

      I'm developing an enterprise application with EJB2.1 and JBoss4.0.
      I have an entity ejb called Document, with some fields containing metadata about a pdf document (author, title, creation date, etc.) and a field where I want to store the entire pdf file.

      Is it possible? How can I do? Which class should I use to store the file in the entity bean?


      Thanks.

        • 1. Re: Store pdf files in the database
          lafr

          We have an antity storing an excel file in database. The field is declared as following:
          /**
          * @ejb.interface-method
          * @ejb.persistence
          * column-name="losgr_attachment"
          * sql-type="BYTE"
          * jdbc-type="LONGVARBINARY"
          * @return Returns the losgrAttachment.
          */
          public abstract java.lang.Object getLosgrAttachment();
          /**
          * @ejb.interface-method
          * @param losgrAttachment The losgrAttachment to set.
          */
          public abstract void setLosgrAttachment( final java.lang.Object losgrAttachment );

          The database field is of type byte (Informix DB) or blob (Oracle 9i).

          The parameter given to the setter is of type byte[].