On 8/17/05, Salim Madjd <[EMAIL PROTECTED]> wrote: > Thanks, Larry. > > Yes, I have gone this far and have all the config and maps setup based on > the documentations. > > Your example is great for stand-alone application. But I am looking for web > application (tomcat 5.x and above or any servlet 2.3 container) and some > best practices.
Hmmm, best practices for web development are to use struts, spring, or JSF. :-) > > For example, where should I put this: > > resource = "blah/SqlMapConfig.xml"; > reader = Resources.getResourceAsReader (resource); > sqlMap = > SqlMapClientBuilder.buildSqlMapClient(reader); > > Should I place it in a listener and load it once at the start of context. > My suggestion (if you are not wanting to use Spring) is to create a class that has a static reference to a sql map in it that contains the code above. Not sexy, but it works. > How should I deal with the thread? I do not understand the question. Can you clarify it please? > Is it best to write a simple filter to handle the resource management? No, no, no, please: no. I have seen that done with hibernate, and IMO, it is one of the worst patterns of anything data-related I can imagine. As un-sexy as the static idea above was, this is worse. Using your web layer to initialize your data layer is just a really, really bad idea. Nancy Reagan was right: "Just say 'no'." Larry
