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.  [ 9 posts ] 
Author Message
 Post subject: Hibernate hangs when i try to insert a Blob multiple times
PostPosted: Tue Oct 02, 2007 10:49 am 
Newbie

Joined: Tue Oct 02, 2007 10:42 am
Posts: 10
Hi,

I am trying to insert a Blob into an oracle database using Hibernate. I am using the approach mentioned at http://hansonchar.blogspot.com/2005/06/oracle-blob-mapped-to-byte-in.html

i.e. converting the BLOB to a byte array.

The problem is the application runs fine when i update a single record. If i try to run the application and update 2 records, Hibernate just hangs at the point where session.getTransaction().commit() gets invoked, so the commit is never invoked.
Any idea what could be the problem?

Any help would be appreciated.

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 02, 2007 6:00 pm 
Newbie

Joined: Wed Aug 17, 2005 3:02 pm
Posts: 7
this is happening to me as well. though, it doesn't happen all the time. there are instances when i can upload 2 - 3 files at a time w/ no problem. also, i know that size is not the issue b/c i've had success with +2Mb files and it's failed in cases where the files that total <1Mb. when the update hangs, it also locks the record since the transaction was never committed so i end up having to restart my app server to get the record released.

Hibernate version: 3.2.2.ga
Database: Oracle 9i


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 03, 2007 3:48 am 
Newbie

Joined: Tue Oct 02, 2007 10:42 am
Posts: 10
I found a work around for the problem. I found that if i commit the session after inovking session.save() for each record it works fine. Earlier i had a single session object ans used it in a for loop to update each record. Now, i commit the session after saving each record and create a new session in the for loop. I dont think this is a very good solution i.e. creating a new session for each row in the loop. Is there any other workaround?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 03, 2007 4:12 am 
Regular
Regular

Joined: Sun Sep 30, 2007 7:51 pm
Posts: 93
Try to do just flush and clear instead of commit, like in batch processing

http://www.hibernate.org/hib_docs/v3/re ... batch.html

Maybe this will work also?

Regards,
Pavol


Top
 Profile  
 
 Post subject: Problem still exists..
PostPosted: Wed Oct 03, 2007 5:54 am 
Newbie

Joined: Tue Oct 02, 2007 10:42 am
Posts: 10
Today when i executed the application even after creatign session in the for loop the problem still occurred. And session.flush() also doesnt work, if i put it, code hangs at the point where session.flush() is invoked. Any idea how i can work around this issue?

Any help would be greatly appreciated, I'm really stuck with this problem.

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 03, 2007 6:10 am 
Regular
Regular

Joined: Sun Sep 30, 2007 7:51 pm
Posts: 93
Can you catch the stack where it hangs?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 03, 2007 6:54 am 
Newbie

Joined: Tue Oct 02, 2007 10:42 am
Posts: 10
code hangs at the point where session.commit() gets executed so this line is never executed. My log file shows the following as its last statement:

DEBUG org.hibernate.jdbc.AbstractBatcher - Executing batch size: 2

There is no exception printed.

Does it make sense?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 03, 2007 8:19 am 
Regular
Regular

Joined: Sun Sep 30, 2007 7:51 pm
Posts: 93
Can you connect with jconsole for example and look the exact stack trace where it hangs?


Top
 Profile  
 
 Post subject: Disabling JDBC batching worked for me
PostPosted: Fri Dec 21, 2007 11:51 am 
Newbie

Joined: Fri Dec 21, 2007 11:29 am
Posts: 2
I was having the exact same problem as parallax555 -- updating multiple BLOBs in a single transaction would hang. In addition, our DBAs were watching the database during the "hang" and Oracle didn't show blocking locks or any signs of distress. The final log statement displayed was:
DEBUG org.hibernate.jdbc.AbstractBatcher - Executing batch size: 2

We are using the Oracle 10.2.0.2.0 JDBC driver, Hibernate 3.0.5, and Oracle 9 database.

Becuase the last logging line was regarding batching, I tried disabling JDBC batching by adding this line to my hibernate.cfg.xml:
<property name="hibernate.jdbc.batch_size">0</property>

Now it works flawlessly! I've inserted up to 10 BLOBs in a single transaction without hanging.

I hope this helps!

Regards,
Tara


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