Hi Dansorry..forgot the codepublic class JdbcCorporateEventDao implements CorporateEventDao {
private JdbcTemplate jdbcTemplate; public void setDataSource(DataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); } // JDBC-backed implementations of the methods on the CorporateEventDao follow... }Personally I like the fact that this Threadsafe config is setup once and then (re)used over and over to multiple DAOsHTHM----------------------------------------------------------------------------- This e-mail message (including attachments, if any) is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, proprietary , confidential and exempt from disclosure. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this communication is strictly prohibited. --------------------------------------------------------------------------- Le présent message électronique (y compris les pièces qui y sont annexées, le cas échéant) s'adresse au destinataire indiqué et peut contenir des renseignements de caractère privé ou confidentiel. Si vous n'êtes pas le destinataire de ce document, nous vous signalons qu'il est strictement interdit de le diffuser, de le distribuer ou de le reproduire. ----- Original Message ----- From: "Daniel Blumenthal" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <user@struts.apache.org> Sent: Wednesday, March 14, 2007 1:37 PM Subject: RE: DataSources > Chris, > > Thanks for the reply - this sounds like just what I need. > >> For instance, Apache Tomcat makes this pretty darned easy. >> You can define a JNDI datasource at the server level, or per >> webapp. The configuration is (roughly) the same; it just goes >> in a different place in your config files. > > I'm using Tomcat 5.5.x. The documentation for this looks pretty good, now > that I know where to look for it. Thanks! > > >> I never use data sources in action code. I find this to be a >> bad practice, since I tend to think of my actions as being in >> the display logic layer, not in my data access layer. >> >> My data access layer is made up of a series of service >> classes which all inherit from a base class which defines a >> getConnection method which roughly does the above (and >> properly checks for null, NamingExceptions, etc.). > > This sounds very similar to what I have. The main difference seems to be > that I pass the DataSource in from the action layer, instead of allocating > it here. > > >> Whatever do you, I would recommend against putting any >> JNDI-specific code into (all) your actions. If you have to >> keep data access in your actions, I would recommend putting a >> getConnection method in your actions' base class and then use >> that instead of Action.getDataSource(). > > This is what I'm doing currently, although it would probably be worthwhile > moving it down into the class mentioned above, as you suggest. > > Thanks again! > > Daniel > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >