0 Replies Latest reply on Nov 10, 2005 4:24 PM by Denis Souza

    Problem with multiple BLOBs on the same entity

    Denis Souza Newbie


      I have an entity that stores images of products in BLOBs. The entity that stores the product images, actualy stores 4 images for each record, which is the same image in various sizes (to be shown in different parts of the site). All of them declared like the following:

      @Column(name = "IMAGE_DATA_LARGE", nullable = true)
      @Lob(type = LobType.BLOB, fetch = FetchType.EAGER)
      public byte[] getLargeImageData() {
       return largeImageData;

      The other three lobs are similar, only differing in the name I used (eg. small for the small image).

      Whenever I persist the object with any one, and only one, of the blobs being non null everything works fine. However, if I more than one of the blobs are not null they are not persisted correctly. It seems hibernate changes their places, eg. the small image is written to the large image column and vice versa.
      When all four blobs are filled in, the order they are written is completely inverted so I get the large image column with the very small image, the medium with the small, the small with the medium and the very small with the large image.

      Has anyone experienced this? Might this be a bug? Might it be that I'm doing something wrong?