cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@holos.pt
Subject Re: Child Contexts
Date Tue, 21 Sep 2010 19:03:55 GMT
Hey Michael and Robert,

Ok so i got the difference between context and connection. So how can i
close all connections before closing an application, a servlet or a
portlet? My main problem here is that on each deploy of a new web
application the connections from former deployments stay on (like memory
leaks), and i need to close them or at least use one pool for the whole
site.

I was thinking about putting the Context on the HTTPSession of the
application server or making a context that is used permanently by the
server... Any ideas how to do it on liferay or tomcat?

Thank you
Bruno

> Hi Bruno,
>
> The Child DataContext *might* share the same database connection as
> the Parent DataContext.  In general, you don't care about this,
> though.  The DataContext, on commitChanges(), will request a database
> connection, use that connection for performing the commit, then return
> the connection back to the pool.  It isn't required that the same
> database connection be used between a performQuery() and a
> commitChanges().
>
> If you do commitChanges() on a Child DataContext, it pushes the
> changes to the Parent DataContext and to the database.  If you only
> want the changes to go to the Parent DataContext and *not* the
> database, use commitChangesToParent().
>
> mrg
>
>
> On Tue, Sep 21, 2010 at 2:22 PM,  <brd@holos.pt> wrote:
>> Hello all,
>>
>> Do Child Contexts share the connection of a parent connection? When i do
>> a
>> commitChanges on the child the change is made on the database or in the
>> parent? I have already read the Nested Contexts page on the User Guide
>> but
>> this detail was confusing for me.
>>
>> Thank you
>> Bruno
>>
>>
>



Mime
View raw message