From: <leg...@at...> - 2004-01-01 09:18:36
|
The following comment has been added to this issue: Author: Gavin King Created: Thu, 1 Jan 2004 3:17 AM Body: It is the job of the connection pool to validate connections and toss out broken connections. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-592 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-592 Summary: SessionFactory goes stale after database restart Type: Bug Status: Unassigned Priority: Critical Project: Hibernate2 Components: core Versions: 2.1.1 Assignee: Reporter: Brian Topping Created: Wed, 31 Dec 2003 1:46 PM Updated: Thu, 1 Jan 2004 3:17 AM Description: It seems impractical to recover a Hibernate SessionFactory from a database restart. Additionally, Hibernate is kicking back a totally bogus stack trace, one has very little connection to the code that is executed. (I'll attach that as soon as I can get a copy of one... I restarted the server and didn't save it...) The problem that I seeing in this particular app is that I am using local configuration objects, not the JBoss service MBean. I cache the SessionFactory calling Config.buildSessionFactory(), but if the database is restarted, it starts blowing these crazy exceptions. I'm also looking at this from an architectural perspective. Confg.buildSessionFactory() is very expensive. So I can't call it all the time. I wouldn't mind calling it if I could sense when it needed to be called (i.e. after the database connection is lost), but the exception does not happen until session.find() is called. Calling SessionFactory.openSession() succeeds just fine. If the logic required could be wrapped in a SessionFactory facade and the Session that is returned can be validated before it is used by the client, that would not be a problem, and I would welcome a suggestion for a lightweight query or connection validation routine that could be used. Should SessionFactory.openSession() be validating the connection before returning it? Failing a good way to make sure that the Session that is returned is good, I am going to have to write global exception catcher that knows how to determine that the SessionFactory is stale, then kill the cache so that it is reloaded on the next time through. Color me lazy, but that seems a bit excessive. thanks! --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |