Hi, I'm having an issue where blobs contain only an empty file after an update. Another weird thing is that I am not using the cascade option in my mapping file, yet calling save() on the "branch" object causes the "leaf" that it references to be updated as well. The code below is not the actual application, rather a simplified test case to explain what I'm trying to do.
I'm happy to post the full source, mapping files, and debug logs if needed, but this example may be quicker to understand.
The basic idea is that the file is transferred to the local disk, analyzed, and then the object is updated to reflect the results of the analysis.
Thanks!
Hibernate version: 3.2.5
Code between sessionFactory.openSession() and session.close():
Code:
Branch branch = new branch();
Leaf leaf = session.load(Leaf.class, 316L);
branch.setLeaf(leaf);
IOUtils.copy(
leaf.getBlob().getBinaryStream(),
new FileOutputStream("test.data"));
leaf.setColor("green");
session.save(branch);
Name and version of the database you are using:
PostgeSQL 8.1.9