Hello,
I'm trying to save some files into database. It works when using byte[] but it don't when using Blob.
PostgreSQL server : 8.2
PostgreSQL Driver : 8.2-504.jdbc3 (also tryied whith 9.0-801.jdbc3)
Hibernate : 3.2.6
Object :
Code:
private Blob fichierAssocie;
public Blob getFichierAssocie() {
return fichierAssocie;
}
public void setFichierAssocie(final Blob valeur) {
this.fichierAssocie = valeur;
}
Mapping hibernate (.hbm.xml)
Code:
<property name="fichierAssocie" column="fichier_associe" type="blob" not-null="false" />
Junit test :
Code:
...
FileInputStream is = new FileInputStream("/tmp/blob.txt");
Blob blb = Hibernate.createBlob(is);
docModele.setFichierAssocie(blb);
docModele = service.modifier(docModele); //perform merge operation and return the modified object
...
the logs show no errors but the column "fichier_associe" is always null.
Do you have any idea ?