Re: How to propoerly close context db connection

From: Marcin Skladaniec (marci..sh.com.au)
Date: Mon Mar 31 2008 - 22:05:03 EDT


I'm not sure, but try this:

query.setCachePolicy(QueryMetadata.LOCAL_CACHE_REFRESH); // or
SHARED_CACHE_REFRESH
or
query.setRefreshingObjects(true)

this will force the refresh of the results of the query you execute,
regardless of what they are

Cheers
Marcin

On 01/04/2008, at 11:13 AM, Colin Bankier wrote:
>
> Thanks Andrus - but shouldn't something like getQueryCache().clear()
> at least
> clear any cache so that cayenne will retrieve the data fresh from
> the DB
> once the file has been overwritten? (Even if the connection isn't
> closed
> properly while this is happening.) This doesn't seem to be having any
> effect.
>
> I've also tried to look at the CAY-632 RefreshQuery, or
> context.invalidateObjects(), but really wanted to refresh the whole
> cache -
> not just a particular collection of objects. Perhaps I just need to
> know how
> to use these correctly.
>
> Any suggestions on how to do this would be greatly appreciated.
> Cheers,
> Colin.
>
>
>
> Andrus Adamchik wrote:
>>
>> 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
>>
>
> --
> View this message in context: http://www.nabble.com/How-to-propoerly-close-context-db-connection-tp16392733p16403625.html
> Sent from the Cayenne - User mailing list archive at Nabble.com.
>





This archive was generated by hypermail 2.0.0 : Mon Mar 31 2008 - 22:05:46 EDT