commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Lear <>
Subject Re: [HiveMind] Question about DAO creation
Date Fri, 03 Oct 2003 15:19:09 GMT
On Friday, October 3, 2003 at 16:33:58 (+0200) Christian Essl writes:
>Than I would give out the DOA directly as a service. Than as you also said 
>(for your second question) I would implement a ConnectionPool service 
>interface and a (or more) implementation(s) (one which just holds one 
>connection - for your testing). Than I would change the DAO-implementation 
>to take a ConnectionPool service as parameter and get the connection from 
>interface ConnectionPool {
>  public Connection getConnection();
>  public void returnConnection(Connection connection);

Hmm, I'm starting to like this.

><service-point id="DAO"
><service-point id="ConnectionPool"

Ok, I think I'm getting the point...

>Now you saved the factory and you have access to the single connection in 
>your test-code. In running code you can still change to a real connection 
>pool. With this suggestion you still have to change both the DAO service- 
>definition and the ConnectionPool definition if you want to change the DAO 
>implementation. However this can be cleaned up, see the Overriding-Services 
>tutorial at the hivemind page.
>Finally: I think (like you) you should if you are going to use a 'real' 
>connection-pool take the connection out of the commands. I would give the 
>commands the connection as a parameter each time they are called. The 
>caller would get it from the ConnectionPool call the command with it and 
>return it straight to the pool.

This is something I've been considering, and I think I'm convinced that
this is a better way to do things.

Thanks for the feedback.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message