-->
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.  [ 4 posts ] 
Author Message
 Post subject: BLOB cutted when I save
PostPosted: Mon Feb 02, 2009 9:54 am 
Newbie

Joined: Wed Apr 16, 2008 3:49 am
Posts: 4
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);

                  
}


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 02, 2009 10:20 am 
Expert
Expert

Joined: Thu Jan 08, 2009 6:16 am
Posts: 661
Location: Germany
I don't know, if there is something similar in oracle, but I faced a problem like this on MySQL. I had to set the packet-size of my database to solve it. Hope that gives you a hint.

_________________
-----------------
Need advanced help? http://www.viada.eu


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2009 4:19 am 
Newbie

Joined: Wed Apr 16, 2008 3:49 am
Posts: 4
Mi mmerder,

I've tried, but the happens the same. I want to believe that the problem is with the drivers, but I going to prove another solutions, if someone works I'll post it here.

Yhanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2009 6:46 am 
Beginner
Beginner

Joined: Wed Jul 09, 2008 5:34 am
Posts: 41
Location: Brno, Czech Republic
Tremal Naik wrote:
Mi mmerder,
I've tried, but the happens the same. I want to believe that the problem is with the drivers, but I going to prove another solutions, if someone works I'll post it here.
Yhanks


Which driver are you using? Can you take a look at https://svn.jboss.org/repos/hibernate/c ... bTest.java ? All the three test methods on this class passes for Oracle 10g, using the driver version 10.2.0.2.0.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.