Craig Tataryn wrote:
<snip/>

> Where I was getting lost was, how do I get a connection from the 
> connection pool all the way down to the bottom level Data layer object?  
> I think I have the answer in that I could just have a kind of central 
> static class that is initialized with the Struts Datasource on web app 
> startup, and the Datalayer objects that need to get a connection to a 
> database in order to manipulate data, could simply ask for it via the 
> static methods of this class.

That's exactly what I'm doing now for the same reasons. My core data 
access classes (StatementUtils) just take commands and parameters. All 
the JDBC work is out of view of the business classes. They just pass an 
command and an object to populate and get back an object or collection 
of objects. The business classes get the commands by passing a token to 
method that accesses a Properties file. Right now, the Properties file 
returns SQL commands, but if they needed to be something else, this 
could be changed without recoding the business classes. You'd have to 
import a different StatementUtils class, but so long as it used the same 
interface, it would plug and play.

-Ted.


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to