|
From: Marc L. <ma...@lo...> - 2005-06-17 09:18:31
|
Hi, ok i see. I didnt noticed that releaseConnection() gets called on getConnection(). Ok this makes sense and i will have a look at the mentioned DataStoreConnectionHandle. thanks. Juergen Hoeller wrote: > The purpose of SimpleConnectionHandle is to hold an existing Connection > reference. We can't close that reference in "releaseConnection", because > "releaseConnection" is gonna be called once per "getConnection" call. So if > the SimpleConnectionHandle will be access multiple times, it's always gonna > return the same Connection, and we can't close until the original creator of > the handle (who also supplied the Connection) decides to shut the handle > down. > > For an alternative implementation of ConnectionHandle, have a look at > DefaultJdoDialect's DataStoreConnectionHandle: this illustrates how a handle > can behave that fetches a fresh Connection for every "getConnection" call > and consequently also closes the Connection for every "releaseConnection" > call. In that particular, it uses JDO 2.0's Connection "borrowing", where > the Connection needs to be returned to the PersistenceManager immediately > after each operation; else the PersistenceManager would complain that we > didn't return the Connection. > > Juergen > > > -----Original Message----- > From: spr...@li... > [mailto:spr...@li...]On Behalf > Of Marc Logemann > Sent: Thursday, June 16, 2005 10:43 PM > To: spr...@li... > Subject: [Springframework-developer] SimpleConnectionHandle > > > Hi, > > is there a reason that SimpleConnectionHandle does not supply a default > releaseConnection implementation? > > I wonder why releaseConnection() cant simply close the Connection it got > upon creation. Instead people tend to close the connection in > JDODialect childs in method releaseJdbcConnection() by getting the > connection from the handle and close it there. -- regards Marc Logemann [blog] http://www.logemann.org [busn] http://www.logentis.de |