Hibernate version:
Hibernate 3
Mapping documents:
<property name="contenidoDocumento" type="blob">
<column name="CONTENIDO_DOCUMENTO" />
</property>
Code between sessionFactory.openSession() and session.close():
Session sess = sessionFactory.openSession();
Transaction tx;
tx = sess.beginTransaction();
sess.saveOrUpdate(instance);
tx.commit();
Name and version of the database you are using:
Oracle 10g
I'm triying save an BLOB but when I execute the sentences below, the content saved is cutted and only saves a bit of this one.
The estrange is that before to save, the lengh ot the Blob is the correctly, but, for example a blob with length 620352 only saves 853 characters.
The segment of code that catch the data is the next one:
Code:
Authenticator.setDefault(new MyAuthenticator());
URL url = new URL(urlAnexo);
InputStream ins = url.openConnection().getInputStream();
BufferedInputStream bufferedInput = new BufferedInputStream(ins);
int iStr;
ByteArrayOutputStream boe = new ByteArrayOutputStream();
int iu=0;
while((iStr = bufferedInput.read()) != -1){
boe.write(iStr);
iu++;
}
boe.close();
byte [] bb = boe.toByteArray();
Blob blob = Hibernate.createBlob(bb);
/* This is the Blob that I save*/
pubFilaDocumento.setContenidoDocumento( blob);
}