5 Replies Latest reply on Apr 11, 2005 2:28 AM by donniedarko

    BLOB limitation issue

    donniedarko

      In my EJB3 entity bean I have successfully been able to represent my small images as a blob, as instructed in the blob wiki.

      @Lob(fetch=FetchType.EAGER)
      public Blob getImage()
      {
       return this.image;
      }
      


      However some of the images are a little bit bigger than 64 kb resulting in cropped images since my database is MySql.

      I have tried to fix this using
      @Column(name="image", columnDefinition="MEDIUMBLOB NOT NULL")
      

      , but later on I read that the columnDefinition is not yet implemented.

      So, is there a way to work around the 64kb limitation by for example using underlying hibernate configuration or hibernate specific annotations?
      Is there a way to specify that my java.sql.Blob should be represented by a MEDIUMBLOB instead of a BLOB as in the old days with standardjaws.xml ?
      Something like:
       <mapping>
       <java-type>java.sql.Blob</java-type>
       <jdbc-type>BLOB</jdbc-type>
       <sql-type>MEDIUMBLOB</sql-type>
       </mapping>
      

      Other strategies? And don't tell me to use filepaths instead of storing theese small images in the database - that is a whole different discussion ;-)

      Thanks in advance...

        • 1. Re: BLOB limitation issue
          bill.burke

          the only thing you can do is create the table yourself I think. Let me know if that is enough.

          Bill

          • 2. Re: BLOB limitation issue
            donniedarko

            By "creating the table yourself" you mean manually with SQL or what? (not CMP), or for example with a servlet that on "init" calls an object that checks tha database and creates the table if it does not exist with a piece of custom database code?

            I was hoping that there was a CMP based soultion to this with EJB 3 , for smooth deployment of a single .ejb3 that creates all the nessesary tables and database related stuff according to the Entity beans contents, but still gives you possibility to override JBoss's choices of underlying database types that are mapped to the entity beans members.

            Are there any plans on supporting this?
            And if there is, will that be by the "columnDefinition" argument on the @column annotation or in any other way?

            Best regards

            • 3. Re: BLOB limitation issue
              bill.burke

              columnDefinition will probably be the way to do this. We will eventually support this, but it may not get in until the final release in June/July.

              • 4. Re: BLOB limitation issue
                epbernard

                columnDefinition will be supported in the next preview release.

                • 5. Re: BLOB limitation issue
                  donniedarko

                  That is fantastic news , thank you.

                  Best regards