Hibernate version: 3.0
Name and version of the database you are using: Firebird 1.5
Hello everyone,
I'm getting a hard time trying to insert a string into a BLOB field in firebird, through Hibernate.
Here's my mapping file:
Code:
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="auge.bean.Cor" table="CORES" >
<id name="cor" column="cor" type="java.lang.String">
<generator class="assigned"/>
</id>
<property name="nome" column="nome" type="java.lang.String" />
<property name="descricao" column="descricao" type="binary" />
</class>
</hibernate-mapping>
"descricao" is the blob field, mapped as a binary. My getters and setters are like this:
Code:
private byte[] descricao;
public void setDescricao(byte[] descricao) {
this.descricao = descricao;
}
public byte[] getDescricao() {
return this.descricao;
}
The insertion occurs successfully, but I suppose it inserts wrong values. When I insert a value through this application, I can't retrieve it. When I try to retrieve it, I get a value like: [B@1e35ecd.
The funny thing is: when I insert a value from isql (firebird's utility), I can retrieve it from isql and I get the weird value from the application. When I insert a value from the application, I get the weird value retrieving from it AND I get nothing from isql.
See my isql results:
Code:
COR NOME DESCRICAO
====== =============== =================
02 VARIADA <null>
03 teste 95:3
==============================================================================
DESCRICAO:
teste_blob
==============================================================================
04 teste 95:5
==============================================================================
DESCRICAO:
aaaaaaaa
==============================================================================
11 11 95:7
==============================================================================
DESCRICAO:
==============================================================================
The line with identifier number 02 has "descricao" as null, so... no problem.
The lines with number 03 and 04 I inserted manually through isql (with insert into...)
The line with number 11 I insert through the application. It comes blank as you see.
Retrieving from the application, I get:
Code:
02 VARIADA
03 teste [B@1a8e53c
04 teste [B@161cd25
11 11 [B@1e35ecd
So, I can only think I'm manipulating it the wrong way. Could someone please help?