-->
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.  [ 1 post ] 
Author Message
 Post subject: Confirming session / connection behavior
PostPosted: Wed Sep 22, 2004 5:02 pm 
Beginner
Beginner

Joined: Tue Jan 27, 2004 6:58 pm
Posts: 20
Hi,

I'm posting this to confirm some session / connection pooling behavior that I have debugged in my Hibernate implementation. I'd appreciate a confirmation if this is correct (or a correction if it is not)

Assumptions - Hibernate with C3P0 for connection pooling, with min and max of the pool set to 1.

The original Hibernate integration interface I wrote would keep an individual session alive for extensive periods of time. I have since re-thought this strategy, but it is not relevant to the behavior at hand.

Our DB terminates connections that are idle for more than 30 minutes. If I were to create a session instance, do a couple of retrievals, and then let the session sit idle for 30 minutes, I would get a Socket exception (or something) indicating that the connection has been dropped.

For some time I tried to get C3P0 to validate and test the connection, but then I realized that C3P0 will only test / validate connections that were not already in use by a session. As I was keeping sessions around for long periods of time, C3P0 would assume that the session was in use and not perform any testing / validation on it. This matches the behavior that I am seeing, so is this correct?

For those that are interested, I am moving towards transient sessions - only keeping them alive long enough to perform a current transaction and then kill it. As business objects in my environment tend to live beyond the space of a single transaction this implies that I will have to manage connecting them to the current session when something interesting needs to be done.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.