If you're using EJB, don't use DAO. You'll end up with too many layers of abstraction. Just build another layer of session beans or even just pojos. And iBATIS DAO is deprecated anyway. The EJB layer will handle declarative transaction configuration for you and iBATIS SQL Maps should be set to use the EXTERNAL (sometimes JTA depending on your container) transaction manager and a JNDI data source.
Clinton On Thu, Jun 26, 2008 at 8:20 PM, Jim Worke <[EMAIL PROTECTED]> wrote: > Hi, > > What is the proper way of using iBatis with EJB? Currently, I have the > following in my stateless session bean ejbCreate(): > > Reader reader = Resources.getResourceAsReader("dao.xml"); > this.daoManager = DaoManagerBuilder.buildDaoManager(reader); > > Then any methods in the session bean that needs to get the DAO will need to > do the following: > > ReportDAO reportDao = (ReportDAO) > daoManager.getDao(ReportDAO.class); > > Is the above method correct? Or should a singleton be used to create the > daoManager and to retrieve the DAO? I'm worried about thread-safety for > singleton with EJB. > > Thanks for your comment! > > > > Regards, > > Jim > > > Get your preferred Email name! > Now you can @ymail.com and @rocketmail.com > http://mail.promotions.yahoo.com/newdomains/sg/ > >