cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Kienenberger <mkien...@gmail.com>
Subject Re: Queries during lost connections
Date Fri, 28 Dec 2012 14:40:09 GMT
On Fri, Dec 28, 2012 at 7:50 AM, Marek Ĺ abo <msabo@buk.cvut.cz> wrote:
> is there any hook for handling lost connections in Cayenne?

I can't find our most recent documentation on this, but it used to
happen automatically with supported databases.

https://cwiki.apache.org/removed/CAY/reconnect.html

http://objectstyle.org/cayenne/lists/cayenne-user/2005/04/0053.html

I have a Cayenne 1.1 system that I maintain which uses Oracle, and
while it may have to fail on two or three queries because of the cycle
of errors returned from an Oracle database when the connection is
lost, it does recover after about three queries.


> My use-case is a system that uses Cayenne with remote database. But when the
> network is down it still needs to fall-back to set of last known values.
>
> I would like to know if Cayenne can let me know somehow that it lost
> connection to DB.
>
> Another thing is - when the DB connection is lost, does Cayenne still serve
> whatever it has in cache? I use only selects and only one insert.

You will have to write your own code to handle what to do during the
failed queries.   A disconnect-related error should come back as a
CayenneRuntimeException.    When you handle it, you will need to
determine if it's a a lost connection error (it probably could be
assumed to be once you're in production) and then return a different
set of queries.   I haven't tried to do this, so I can't tell you the
best way to pull the objects out of a cache.

Mime
View raw message