-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate appears to be locking up when opening a connection
PostPosted: Thu May 03, 2007 4:44 am 
Newbie

Joined: Wed May 02, 2007 5:58 am
Posts: 2
Hi I am havig some issues with hibernate locking after a few transactions.
I am using the hibernate mapping objects to perform updates.
The call in the code is as follows
getHibernateTemplate().update(msgStatus);

Where msgStatus is the mapping object. This works fine for a while, but after a few updates the database locks up.
With the showsql turned on I, appears to be occuring at this line

ConnectionManager.openConnection() - opening JDBC connection
More of the stack trace is shown below. Has anyone come across this before?
Appreciate any pointers.
B

Necom.aepona.tws.parlayx.multimedia_messaging.send.v2_4.dao.MmmStatuses{destAddress=02871346009, correlator=null, createdAt=2007-05-02 10:14:54, interfaceName=null, endPointUri=null, messageId=InvalidMessageID, sessionId=42, deliveryStatus=DeliveredToNetwork, mmmId=74004}
2007-05-02 10:15:17,831 [pool-3-thread-1] DEBUG AbstractFlushingEventListener.performExecutions() - executing flush
2007-05-02 10:15:17,831 [pool-3-thread-1] DEBUG ConnectionManager.flushBeginning() - registering flush begin
2007-05-02 10:15:17,832 [pool-3-thread-1] DEBUG AbstractEntityPersister.update() - Updating entity: [com.aepona.tws.parlayx.multimedia_messaging.send.v2_4.dao.MmmStatuses#74004]
2007-05-02 10:15:17,832 [pool-3-thread-1] DEBUG AbstractBatcher.logOpenPreparedStatement() - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2007-05-02 10:15:17,833 [pool-3-thread-1] DEBUG ConnectionManager.openConnection() - opening JDBC connection


Top
 Profile  
 
 Post subject: Re: Hibernate locking up when opening a connection
PostPosted: Fri May 04, 2007 12:16 am 
Newbie

Joined: Fri Apr 15, 2005 7:52 pm
Posts: 13
You might be running out of (and leaking) connections, the connection pool can either throw an exception or stall in that case. Check which connection pool you are using and configure it so that it will throw an exception in case it runs out of connections (at least while you're developing). Make sure that you're closing every connection / hibernate session that you're using (e.g. within a finally clause). Also you might want to use a debugger and interrupt the thread while it is stalling to see which method exactly is blocking.


Top
 Profile  
 
 Post subject: Found the solution.
PostPosted: Fri May 04, 2007 12:14 pm 
Newbie

Joined: Wed May 02, 2007 5:58 am
Posts: 2
Yeah it was running out of connections.
However as using the hibernateTemplate it should have been releasing each connection - and indeed it was. The problem arose as was using the Query object to perform a select on the database. The Query object gets a connection OK but does not actually release it!! Mayeb I'm missng a config paramter somewhere but the solution was to force the connection close after each query.
The code is below. Thanks for any responses.

final String queryString = "from MmmStatuses as status where status.sessionId = ?";
final Session sess = getSession();
final List retval;

try {
final Query queryObject = sess.createQuery(queryString);
queryObject.setParameter(0, sessionID);
retval = queryObject.list();
} finally {
sess.close();
}
return retval;


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