commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Essl <christiane...@yahoo.de>
Subject Re: [HiveMind] Question about DAO creation
Date Fri, 03 Oct 2003 15:58:18 GMT
Yes that's better at least I always said your answer is better.
On Fri, 03 Oct 2003 11:23:07 -0400, Harish Krishnaswamy 
<hkrishnaswamy@comcast.net> wrote:

> Why not use an off-the-shelf pooling library like DBCP or CP03(?) or 
> something?
>
> -Harish
>
> Bill Lear wrote:
>
>> 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 there.
>>>
>>> interface ConnectionPool {
>>> public Connection getConnection();
>>> public void returnConnection(Connection connection);
>>> }
>>>
>>>
>>
>> Hmm, I'm starting to like this.
>>
>>
>>
>>> <module...>
>>>
>>> <service-point id="DAO"
>>> ...
>>> </service>
>>>
>>> <service-point id="ConnectionPool"
>>> ...
>>> </service>
>>>
>>>
>>
>> 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.
>>
>>
>> Bill
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>
>>
>>
>>
>



-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message