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: Default session closure time out.
PostPosted: Wed Aug 05, 2009 12:57 am 
Newbie

Joined: Wed Jan 09, 2008 2:48 am
Posts: 1
I have following code.
[code]
SessionFactory sfo = new SessionFactory():
Session session = sfo.openSession();
Connection dbCon = session.connection();
connection.close();
// I am not closing session.
[/code]

Followign is Config file
[code]
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.datasource">osc_trdbcache</property>
<property name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
</session-factory>
</hibernate-configuration>
[/code]


I am not closing session, but code works fine till certain load (25 concurrent requests)
[quote]
My question is how does Hibernate work internally in this case?
[/quote]
[quote]
Is there any default session closure time out, either at Hibernate end or at Oracle end?
[/quote]

_________________
Regards,
Hardik


Top
 Profile  
 
 Post subject: Re: Default session closure time out.
PostPosted: Wed Aug 05, 2009 3:56 am 
Beginner
Beginner

Joined: Mon Feb 19, 2007 4:22 am
Posts: 22
Location: Poland
There is no timeout on Hibernate session. Lacking to do so will cause resources leak.

Usually there is no need to close connection explicitly, closing session will do this for you. I am not pretty sure about this but I think that closing connection manually will not notify the connection pool about the connection release. This may lead to incorrect behaviour too.

I can not see it in your code but watch out for transanction management.


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.