Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-dev] Query retry limited to ReadOnly Queries

Hi Tom,
This is the code excerpt from AbstractSession.class inside the function:
public Object executeQuery(DatabaseQuery query, AbstractRecord row, int retryCount) throws DatabaseException {

//if this query is a read query outside of a transaction then we may be able to retry the query

if (!isInTransaction() && query.isReadQuery()) {

//was the failure communication based? (ie timeout)

if (databaseException.isCommunicationFailure()) {

Object[] args = new Object[1];
Also, from the documentation, I see the following:
void org.eclipse.persistence.sessions.DatabaseLogin.setDelayBetweenConnectionAttempts(int delayBetweenConnectionAttempts)
PUBLIC: Stores the number of milliseconds that EclipseLink will wait between attempts to reconnect a DatabaseConnection in the case EclipseLink is attempting to retry a query. EclipseLink will retry a read query outside of a transaction if EclipseLink can determine that a communication error occurred with the database.
Open Declaration void org.eclipse.persistence.sessions.DatabaseLogin.setQueryRetryAttemptCount(int queryRetryAttemptCount)

PUBLIC: Set the number of attempts EclipseLink should make to re-connect to a database and re-execute a query after a query has failed because of a communication issue. EclipseLink will only attempt to reconnect when EclipseLink can determine that a communication failure occurred on a read query executed outside of a transaction. By default EclipseLink will attempt to retry the query 3 times, by setting this value to 0 EclipseLink will not retry queries.

--- On Fri, 10/7/11, Tom Ware <tom.ware@xxxxxxxxxx> wrote:

From: Tom Ware <tom.ware@xxxxxxxxxx>
Subject: Re: [eclipselink-dev] Query retry limited to ReadOnly Queries
To: eclipselink-dev@xxxxxxxxxxx
Date: Friday, October 7, 2011, 3:10 PM

Can you point me to the code that just retrys for read only queries.  I am
looking at AbstractSession.executeQuery() in our 2.3.1 stream and I see no such


On 05/10/2011 4:19 PM, sridhar baratam wrote:
> Hi All,
> It appears the query retry logic will only happen for READONLY queries on a
> connection communication error. Is there a specific reason for that? A
> non-READONLY query can still fail on a communication error. Due to this specific
> restriction, I believe it puts the onus back on the application to code around
> these failures for non-readonly queries during communication errors. This may
> not be optimal considering the whole logic behind using JPA where developers can
> focus on the business logic and do not have to worry about the database stuff. I
> could be wrong here and wonder if there is a specific reason to have the retry
> limited to READONLY queries.
> Can someone throw somelight in this regard?
> Thanks
> Sridhar
> _______________________________________________
> eclipselink-dev mailing list
> eclipselink-dev@xxxxxxxxxxx
eclipselink-dev mailing list

Back to the top