ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gregg D Bolinger <gthou...@gmail.com>
Subject iBatis DAO Loading dao.xml
Date Mon, 02 May 2005 03:55:31 GMT
I am testing using iBatis DAO with iBatis SqlMaps in a web
application.  Right now I have a BaseService that looks like this:

public abstract class BaseService {

    public static final String DAO_XML_PATH =

    protected DaoManager daoManager;

    public BaseService(){
            final Reader reader = Resources.getResourceAsReader(DAO_XML_PATH);
            daoManager = DaoManagerBuilder.buildDaoManager(reader);
        }catch(IOException e) {

All my Service class extend this base service.  What I would like to
know is if there is a way to load the daoManager into the
ServletContext somehow so that I am not parsing the dao.xml file with
every service request.  I'd like to do it once when the Webapp loads
and just pull the daoManager from the ServletContext.  Is it as easy
as creating a ContextListener to do this?  Is there one in the API
that I don't know about?  Writing my own isn't a problem though.

View raw message