1 Reply Latest reply on Nov 23, 2006 3:18 AM by tcom tcom

    Problem with @Lob annotation and MySql

    tcom tcom Newbie

      I want to persit a photo of a person in my database. In order to do that, I'am using the code below:

      public class Personne implements Serializable{
       private ImageIcon photo;
       public ImageIcon getPhoto() {return photo;}
       public void setPhoto(ImageIcon photo) {this.photo = photo;}

      When I persist the entity, it's Ok but when I'am trying to extract it form the DB I got an EOFException.
      @Lob make the attibute photo mapped as a blob but Blob type in MySQL seems to not support more than 64kB of data. In most of case my photos have a bigger size than 64KB and they are simply truncated.
      To resolve the problem, I changed the type directly in the DB into LongBlob and now it is working fine.
      So, my question is : Is there a way to have my attribute directly mapped as a LongBlob?

      Thanks in advance

      System informations:
      jboss 4.0.4.GA
      EJB RC8
      MySQL 4.1.9 and connector 3.1.14