Hi Sabra,

IMHO I think we should close the db connection in the Dao Manager. That way
Dao manager has the control over the transactions and we can implement fine
grained Dao Classes.

Regards,
Samith

On Thu, Jun 23, 2016 at 10:28 PM, Danushka Fernando <danush...@wso2.com>
wrote:

> Ping
>
> Thanks & Regards
> Danushka Fernando
> Senior Software Engineer
> WSO2 inc. http://wso2.com/
> Mobile : +94716332729
>
> On Fri, Jun 17, 2016 at 1:55 PM, Sabra Ossen <sa...@wso2.com> wrote:
>
>> Hi All,
>>
>> What is the best practice for closing database connections when we are
>> using the DAO Pattern with DAO Manager?
>>
>> According to [1] the suggestion is to create a DAO Manager and include
>> the database connection object within the DAO Manager. Each DAO Object is
>> instantiated by passing the database connection and the connection is
>> closed from the DAO Manager after execution of the query.
>>
>> I went through a lot of WSO2 product related code but was not able to see
>> the usage of a DAO Manager and I saw that the database connections were
>> closed in the DAO class itself.
>>
>> What is the suggested practice? Any clarification on this issue is
>> appreciated.
>>
>> [1] http://tutorials.jenkov.com/java-persistence/dao-manager.html
>>
>> Thanks and Regards.
>>
>> --
>> *Sabra Ossen*
>> *Software Engineer*
>> Email: sa...@wso2.com
>> Mobile: +94 767 837356
>>
>> _______________________________________________
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Best Regards

Samith Dassanayake
Senior Software Engineer | Cloud TG
WSO2, Inc. | http://wso2.com
lean. enterprise. middleware

Mobile : +947 76207351
Blog : buddycode.blogspot.com
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to