|
You have to close the connection in every methods
public Page
findByKey( String key, int start, int count )
stmt.setString ( 1, key );
ResultSet rs = stmt.executeQuery ( ); ����������� Cnn.close()
return toPage ( rs, start, count );
So.. is not good idea to have the connection as a field of this class.
HTH
-----Mensaje original-----
Hi all,
I'm writing a DAO and using the xpetstore application for some guidance. However, I think I may have found a bug.
The xpetstore uses a session facade to search for particular products. It contains two methods used for this - one to get the database connection, and the other to invoke the a DAO with the search parameters - really nice and simple:
//------------- session facade methods-----------------------------
/**
//------------- DAO method -----------------------------
public
ProductDAO( Connection cnn )
public Page
findByKey( String key, int start, int count )
stmt.setString ( 1, key );
ResultSet rs = stmt.executeQuery ( );
return toPage ( rs, start, count );
However, my question is - why isn't the database connection getting closed? Should it be getting closed?
thanks very much, Brian
|
- [JBoss-user] Closing database connections Brian McSweeney
- RE: [JBoss-user] Closing database connections Martin Vilcans
- Re: [JBoss-user] Closing database connections Brian McSweeney
- Re: [JBoss-user] Closing database connectio... Herve Tchepannou
- RE: [JBoss-user] Closing database connectio... Martin Vilcans
- Re: [JBoss-user] Closing database conne... Brian McSweeney
- Re: [JBoss-user] Closing database connections Enrique Rodr�guez
- Re: [JBoss-user] Closing database connections Brian McSweeney
- RE: [JBoss-user] Closing database connections Alastair Rodgers
- Re: [JBoss-user] Closing database connections Brian McSweeney
