Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 48574 invoked from network); 1 Apr 2008 08:47:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Apr 2008 08:47:58 -0000 Received: (qmail 89965 invoked by uid 500); 1 Apr 2008 08:47:57 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 89949 invoked by uid 500); 1 Apr 2008 08:47:57 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 89940 invoked by uid 99); 1 Apr 2008 08:47:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Apr 2008 01:47:57 -0700 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.78.103.231] (HELO vorsha.objectstyle.org) (208.78.103.231) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 01 Apr 2008 08:47:16 +0000 Received: (qmail 11977 invoked from network); 1 Apr 2008 08:47:28 -0000 Received: from unknown (HELO ?IPv6:::1?) (127.0.0.1) by localhost with SMTP; 1 Apr 2008 08:47:28 -0000 Message-Id: <095B3F8E-8793-4378-AA2E-7E9646B0B0C4@objectstyle.org> From: Andrus Adamchik To: user@cayenne.apache.org In-Reply-To: <16403625.post@talk.nabble.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v919.2) Subject: Re: How to propoerly close context db connection Date: Tue, 1 Apr 2008 11:47:26 +0300 References: <16392733.post@talk.nabble.com> <5F3D51AC-2CDE-4159-84A0-A7263DB9F1CD@objectstyle.org> <16403625.post@talk.nabble.com> X-Mailer: Apple Mail (2.919.2) X-Virus-Checked: Checked by ClamAV on apache.org Hi Colin, Cayenne internal cache state is in no way related to the connection state - it can survive closing connections, etc. If you are connecting to a separate DB process, Cayenne cache management techniques (as mentioned by Marcin, and what you found in the docs), is the only thing you need to know. Embedded DB's add a whole other dimension to that by keeping committed data in memory at the driver level - something Cayenne is not aware of. So anything you do with "clearCache" or RefreshQuery, etc., affects Cayenne cache, and not the embedded DB JDBC layer. So here you'd need to read the embedded DB docs (is that Derby, HSQL, H2?) and see what they recommend to do in such situation. There maybe a SQL query that would shutdown/reopen the file, or something else (like restarting the DataSource). Andrus On Apr 1, 2008, at 4: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. > >