Pretty simple question with almost no answers on the web. I am using byte[] as my object. Currently I am reading the entire image into memory and then writing it. Very simple.
@Column(name = "FILE_DATA")
private byte[] fileData;
I want to Stream it in. So I guess I need to use inputStream, but hibernate does not like that.
How do I set this up?
EDIT:
I tried this but got a -314 db2 error:
Blob b = null;
try {
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxy.com", 80));
URL urls = new URL(url);
URLConnection conn = urls.openConnection(proxy);
b = new BlobImpl(conn.getInputStream(), conn.getContentLength());
} catch (Exception e) {
e.printStackTrace();
}
att.setFileData(b);
this.theDao.save(att);