RE: [OJB-developers] bug in statementforclass in managed environm ent
Brought to you by:
thma
From: Matthew B. <ma...@so...> - 2002-05-06 00:19:30
|
Ignore this. Didn't look through code enough, noticed we check if the connection is closed, and get a new one if it is. -----Original Message----- From: Matthew Baird [mailto:ma...@so...] Sent: Sunday, May 05, 2002 12:54 PM To: obj...@li... Subject: [OJB-developers] bug in statementforclass in managed environment This one took a while to track down, I think I'm getting slower in my old age. Currently in StatementForClass.java private Connection getConnection() throws SQLException { try { return manager.getConnectionForClassDescriptor(cld); } catch (PersistenceBrokerException e) { throw new SQLException("OJB Error: could not obtain a Connection"); } } we get a connection for the classDescriptor, and we cache the connection in a connection table. In a managed environment, the connection is disassociated from the managed connection, and thus when we come back to reuse the connection, it's invalid (not associated with a managed connection). The method should be: private Connection getConnection() throws SQLException { try { return manager.getNewConnectionForClassDescriptor(cld); } catch (PersistenceBrokerException e) { throw new SQLException("OJB Error: could not obtain a Connection"); } } in the StatementForClass.java, and I created a getNewConnectionForClassDescriptor method in the manager that just returns a new connection. This brings up a philosophical question though... Who is responsible for connection pooling. I would argue that it should NOT be OJB. Let the driver, the appserver, or a plugin like poolman to do that. We run into too many problems if we try to be fancy here. Besides, getting a new connection will always work (well... more than the cached one) Cheers, Matthew _______________________________________________________________ Have big pipes? SourceForge.net is looking for download mirrors. We supply the hardware. You get the recognition. Email Us: ban...@so... _______________________________________________ Objectbridge-developers mailing list Obj...@li... https://lists.sourceforge.net/lists/listinfo/objectbridge-developers |