HibernateSession.close() will close the connection and return it to the
pool.
The real JDBC connection isn't actually closed at that moment but only =
the
proxied one given to Hibernate by the pool.
If your pool isn't configured to validate the connection on borrow, then =
you
may give a closed/dirty connection to Hibernate and therefore receiving =
an
exception the first time Hibernate wants to do something with it.
In most cases, the problem you experience is caused by a wrong Hibernate
session handling. Make sure you don't reuse the same session across =
multiple
calls, make sure your session is actually (and properly) closed, turn on
Hibernate and Proxool debugging and you will probably find the answer to
your problem.
(BTW: pretty sure you don't get this exception the first time your timer
fires but the second time well... This is a good indication of bad =
Hibernate
session handling :(
-bertrand
-----Original Message-----
From: proxool-user-admin@...
[mailto:proxool-user-admin@...] On Behalf Of Per =
Thomas
Jahr
Sent: mardi 26 octobre 2004 10:31
To: proxool-user@...
Subject: [Proxool-user] Connection remains active when closing session =
in
Hibernate
Hi,
This is maybe a Hibernate question. But I will try my question here
first:
I have an application that uses Proxool 8.3 and Hibernate 2.1.6. In this
application I have a timer thread that runs every 10 minutes. This =
thread
does a query against a database. This is a not a complex query and it
returns within milliseconds.
The problem is that I get a SqlException and "connection closed" when =
the
timer fires. This is because the housekeeper kills the connection. The
connection has reached the maximum-active-time so the housekeeper kills =
it.
So, the question is: shouldn't Hibernate's session.close() return the
connection to the Hibernate pool?=20
Instead it seems like the connection remains active even after
session.close(). As I understand it the status of the connection should =
be
available (and not active) after session.close().
Thanks
--=20
Per Thomas Jahr
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal =
Use
IT products in your business? Tell us what you think of them. Give us =
Your
Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Proxool-user mailing list
Proxool-user@...
https://lists.sourceforge.net/lists/listinfo/proxool-user
|