fast forward to Nov 2008 and Hibernate 3.2, I'm unable to update the blob as well. No problems inserting new rows with blob images.
Code:
@Column(name="MIME_TYPE", length=35, nullable=false)
private String mimeType;
@Lob // 500Kb
@Column(name="IMAGE", length=510000, nullable=false)
private Blob image;
@Lob //30kb
@Column(name="THUMBNAIL", length=30000, nullable=false)
private Blob thumbNail;
here's how i set the blobs from an incoming MultipartFile
Code:
MyImageEntity(org.springframework.web.multipart.MultipartFile image){
InputStream sourceStream = image.getInputStream();
ByteArrayOutputStream out = new ByteArrayOutputStream();
ImageUtil.resize(400, "JPEG", sourceStream, out);
byte[] resizedBytes = out.toByteArray();
image = Hibernate.createBlob(resizedBytes);
ByteArrayInputStream resizedByes2 = new ByteArrayInputStream(resizedBytes);
out = new ByteArrayOutputStream();
ImageUtil.resize(100, "JPEG", resizedByes2, out);
thumbNail = Hibernate.createBlob(out.toByteArray());
Why won't hibernate update the blob itself with update() or merge() ? Other columns do get updated however (mimeType for example)