-->
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.  [ 6 posts ] 
Author Message
 Post subject: Require Help in clearing inactive sessions
PostPosted: Thu Feb 25, 2010 5:00 am 
Newbie

Joined: Thu Feb 25, 2010 4:44 am
Posts: 1
I am using a standalone hibernate connection for oracle connection(without spring) in my application for a process. i am opening new hibernate session for every cycle of the process and also close at the end of every cycle. But the session that were opened and closed for the process still have entry in the v$session table in Inactive status however the only session that is currently used is present in the active status. because these used sessions gets stagnated in the Inactive state even after closing them, after a limit i am not able to open any new session. In other words it also leads to total loss of DB connection. Is there any way to get rid of these Inactive sessions?

can anyone help me in clearing this problem?


Top
 Profile  
 
 Post subject: Re: Require Help in clearing inactive sessions
PostPosted: Fri Feb 26, 2010 3:05 am 
Senior
Senior

Joined: Wed Sep 19, 2007 9:31 pm
Posts: 191
Location: Khuntien (Indonesia)
vijiguna wrote:
I am using a standalone hibernate connection for oracle connection(without spring) in my application for a process. i am opening new hibernate session for every cycle of the process and also close at the end of every cycle. But the session that were opened and closed for the process still have entry in the v$session table in Inactive status however the only session that is currently used is present in the active status. because these used sessions gets stagnated in the Inactive state even after closing them, after a limit i am not able to open any new session. In other words it also leads to total loss of DB connection. Is there any way to get rid of these Inactive sessions?

can anyone help me in clearing this problem?


Can you post the log please?
Try to call sessionFactory.getCurrentSession() instead of sessionFactory.openSession()


Top
 Profile  
 
 Post subject: Re: Require Help in clearing inactive sessions
PostPosted: Sat Apr 17, 2010 1:35 am 
Newbie

Joined: Sat Apr 17, 2010 1:25 am
Posts: 2
I have one application which is using Struts Framework and Hibernate. In my application, Whenever code fetches data from database using hibernate , it makes some inactive sessions in database. in code we have used getCurrentSession method. we have closed the session object also. but still we are getting inactive sessions in database for each of the methods.

Another thing is we are using hibernate-cfg.xml. Is there anyway where we can define to kill the session automatically after some particular time.


please reply to this post asap. I want to fix this asap.


Top
 Profile  
 
 Post subject: Re: Require Help in clearing inactive sessions
PostPosted: Sat Sep 04, 2010 8:59 pm 
Newbie

Joined: Fri Oct 30, 2009 11:41 am
Posts: 6
Hi,

for that workaround, manually closing timed out connections, depending on the database engine your using, you could probably specify a connection timeout in jdbc url. I've shamelessly recurred to this trick before, as a last chance to overcome my lack of knowledge :)


Top
 Profile  
 
 Post subject: Re: Require Help in clearing inactive sessions
PostPosted: Sun Sep 05, 2010 12:10 am 
Newbie

Joined: Sat Apr 17, 2010 1:25 am
Posts: 2
Hi All,

I got the solution for this issue. We can use JNDI entry in hibernate-cfg.xml file We have connection attribute in the xml file there we can define which JNDI entry is required for the connection. So each time when u create sessionFactory object it will take the existing one untill u close it.

Let me know if further clarifcation required


Top
 Profile  
 
 Post subject: Re: Require Help in clearing inactive sessions
PostPosted: Thu Jun 23, 2011 9:19 am 
Newbie

Joined: Thu Jun 23, 2011 9:14 am
Posts: 1
Hi,
I am facing the same problem. Could you plz clarify the solution. Which JNDI entry u mean?


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