2 Replies Latest reply on Nov 4, 2005 5:29 AM by Emmanuel Bernard

    Mapping binary (BLOB) field not possible?

    Marius Oancea Novice

      Hi,
      I have a entity named Learnitem having a blob field inside:

      @Entity
      @Table(name = "learnitem")
      public class Learnitem implements Serializable {
      ...
       private Byte[] learnitemDocument;
       @Basic(fetch = FetchType.LAZY)
       @Column(name = "LEARNITEM_DOCUMENT")
       @Lob(fetch = FetchType.LAZY, type = LobType.BLOB)
       public Byte[] getLearnitemDocument() {
       return this.learnitemDocument;
       }
      
       public void setLearnitemDocument(Byte[] learnitemDocument) {
       this.learnitemDocument = learnitemDocument;
       }
      
      ...



      If I try to read the content of that field I got :
      11:59:54,137 INFO [SerializableType] could not read column value from result set: LEARNITEM3_21_0_
      11:59:54,137 INFO [DefaultLoadEventListener] Error performing load command
      org.hibernate.type.SerializationException: could not deserialize
       at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:211)
       at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:234)
       at org.hibernate.type.SerializableType.fromBytes(SerializableType.java:78)
       at org.hibernate.type.SerializableType.get(SerializableType.java:39)
      ...



      Any ideea why ?


      If the binary content in the DB is null the system reads the LearnItem without problems.

      Any workaround ?


      Note: I'm using jboss 403 and 403SP1, MySQL 5.0 and mysql-connector-java-3.0.15-ga-bin.jar

      Thanx in advance.