Is there a way to read and write from blob in chunks using Hibernate . Right now I am getting an OutOfmemoryException because all blob data is loaded into memory in byte[] .
To be more specific, let's say I want to save a large file in a database table called File .
public class File { private byte[] data; }
I open the file in FileInputStream, and then what? How do I tell Hibernate that I need streaming content and not pass the entire byte[] array at once? Should I use blob instead of byte[] ? Anyway, how can I transfer the content?
As for reading, is there a way by which I can say that hibernation (other than lazy loading), I need the blob to load into pieces, so when I return my File , it should not give me an OutOfmemoryException .
I use:
- Oracle 11.2.0.3.0
- Hibernate 4.2.3 final
- Oracle Driver 11.2
java oracle stream hibernate blob
Atticus
source share