cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: How to propoerly close context db connection
Date Mon, 31 Mar 2008 08:51:50 GMT
Cayenne itself works with a DataSource. All connection management and  
starting and stopping the embedded DB is deferred to the DataSource  
and is beyond Cayenne scope. The default DataSource implementation  
pools connections. If you need a different policy, you need to provide  
a DataSource that does whatever is appropriate in your environment.  
Custom DataSource is installed by providing a special  
DataSourceFactory for a give DataNode in the Modeler.

Andrus



On Mar 31, 2008, at 9:58 AM, Colin Bankier wrote:
> Hi,
> I can't seem to find any examples of how to properly close a database
> connection and clear any related cache.
>
> My app is using an embedded database, of which it can download a new  
> version
> and overwrite the old one.
>
> At the moment I try to clear any cache using  
> context.getQueryCache().clear()
> (context is my DataContext instance).
> And then set the context to null (for want of anything better to do).
>
> The app then downloads and copies a new version of the database over  
> the
> old, and connects using context = DataContext.createDataContext()  
> etc etc.
>
> However - the data displayed STILL is the old data - until the app is
> shutdown and re-started when it correctly reads the new data.
>
> Any help on how to properly close the database connection would be  
> greatly
> appreciated.
> Cheers,
> Colin Bankier.
> -- 
> View this message in context: http://www.nabble.com/How-to-propoerly-close-context-db-connection-tp16392733p16392733.html
> Sent from the Cayenne - User mailing list archive at Nabble.com.
>
>


Mime
View raw message