-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate, Firebird, Blob and problems
PostPosted: Thu Sep 01, 2005 3:37 pm 
Regular
Regular

Joined: Mon Aug 29, 2005 9:46 am
Posts: 102
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?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 02, 2005 8:52 am 
Regular
Regular

Joined: Mon Aug 29, 2005 9:46 am
Posts: 102
I shall add more information.

I tried to use this tip: http://www.hibernate.org/73.html from which I got the error:

Code:
org.firebirdsql.jdbc.FBSQLException: You must use FBBlobs with Firebird.


Alright... it's a way to go. But what in the world would be a FBBlob?

Man, I do not wanna give up... right now I'd be happy if someone said: "Yes, I used blobs with Hibernate and Firebird, it's possible"


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.