When merging an entity it appears that @Lob blobs are not being persisted. I've seen this when merging a newly created entity - I haven't tested whether the problem also exists when merging a detached entity.
I have an entity with a blob:
Code:
@Lob
@Column(name = "DATA")
private Blob data;
This works:
Code:
FileAttachment attach = new FileAttachment();
...
attach.setData(manager.createBlob(input));
manager.persist(attach);
...
FileAttachment attach = manager.lookupFileAttachment(2L);
assertNotNull(attach.getData());
But this doesn't:
Code:
FileAttachment attach = new FileAttachment();
...
attach.setData(manager.createBlob(input));
attach = manager.merge(attach);
assertNotNull(attach.getData()); //FAILS
...
attach = manager.lookupFileAttachment(2L);
assertNotNull(attach.getData()); //FAILS
I've only seen this happening to the blob. Other types appear to merge successfully.
Versions:
- hibernate 3.2.0-cr1
- hibernate-annotations 3.1beta9
- hibernate-entitymanager 3.1beta7