ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Yee <r...@cruzio.com>
Subject Storing the DaoManager
Date Sat, 19 Feb 2005 17:50:53 GMT
I'm using the DaoManager to manage my sqlMapDao classes. I invoke the 
DaoManagerBuilder.buildDaoManager(Reader) method in a ContextListener or a 
init method of a Servlet that is configured to load-on-startup and then 
store the DaoManager in the application context. For each request I then 
get the DaoManager from the application context and get my DAO from it in 
order to execute a database query. Is this all correct? I want to make sure 
that my application is able to handle a lot of traffic and that I don't tie 
up database connections unnecessarily. Can anyone tell me when the database 
connections are opened and closed. When using the SqlMapDaoTemplate, I 
suppose it is done from within the getSqlMapExecutor().queryForXXXX 
methods. What happens with the JdbcDaoTemplate? Since there is only one 
method, getConnection(), when is this connection closed? When the 
connection is closed, will it close any statements or result sets that are 
open or do I still need to handle those in a finally clause?

Sorry if these questions are basic. I'm used to handling the closing of the 
result sets, statements and connections myself and feel a little uneasy 
leaving the cleanup to a framework.

In most cases I plan to use SqlMaps. However, I sometimes have to use JDBC 
in order to handle stored procedures and functions.



View raw message