[jboss-user] [EJB 3.0] - Problem with @Lob annotation and MySql

tcomtcom do-not-reply at jboss.com
Wed Nov 22 10:05:35 EST 2006


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


  | @Entity
  | @Table(name="PERSONNE")
  | @Inheritance(strategy=InheritanceType.JOINED)
  | public class Personne implements Serializable{
  | 
  |     private ImageIcon photo;
  |     ...
  | 
  |     @Lob
  |     @Basic(fetch=FetchType.LAZY,optional=true)
  |     @Column(name="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





View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3987905#3987905

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3987905



More information about the jboss-user mailing list