Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Attempting to retry query(EclipseLink-4002)
Attempting to retry query [message #904528] Tue, 28 August 2012 16:01 Go to next message
Igor B is currently offline Igor BFriend
Messages: 9
Registered: July 2012
Junior Member
Hi,

I found a strange behaviour with EclipseLink as soon as I get a DatabaseException while I use a value which is too long for the database: The Exception is:

<28.08.2012 17:42 Uhr MESZ> <Notice> <EclipseLink> <BEA-2005000> <2012-08-28 17:42:43.886--UnitOfWork(32101512)--Communication failure detected when attempting to perform read query outside of a transaction. Attempting to retry query. Error was: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.ibm.db2.jcc.am.co: DB2 SQL Error: SQLCODE=-302, SQLSTATE=22001, SQLERRMC=null, DRIVER=3.57.82
Error Code: -302

The funny thing is, that EclipseLink try to retry the query but always reports the same error, this happens around 7 times until it returns the control to the program. The side effect is that this spends a lot of time (~10s).

The code looks like this:

Query _query = aEm.createNamedQuery("findCodeSystemWert");
_query.setParameter("systemNr", getSystemNr());
_query.setParameter("sprache", getSprachCode);
_query.setParameter("codeWert1Int", getCodeWert1Int());
_query.setParameter("codeWert1An", getCodeWert1An()); // value is more than CHAR(10)
_query.setParameter("datum", getSuchDatum());

//Here happens the retry automatically!!!
CodeWert1 _result = (CodeWert1)_query.getSingleResult();


The Code runs within a Stateless Session Bean on Weblogic Server and uses the following persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence>
<persistence-unit name="service.codesystem" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>db2_txds</jta-data-source>
<class>CodeSystem</class>
<class>CodeSystemDefinition</class>
<class>CodeWert1</class>
<class>CodeWert2</class>
<class>CodeWert3</class>
<class>CodeWert4</class>
<shared-cache-mode>NONE</shared-cache-mode>
</persistence-unit>
</persistence>


How I can change the behaviour, so that EclipseLink does not make any retry?

best regards,

Igor
  • Attachment: log.txt
    (Size: 7.28KB, Downloaded 201 times)

[Updated on: Tue, 28 August 2012 16:01]

Report message to a moderator

Re: Attempting to retry query [message #904999 is a reply to message #904528] Wed, 29 August 2012 14:34 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

That is odd, EclipseLink does retry queries, but only if it thinks the database connection is dead. What is the error message for your database error? Is the database connection dead?
When a database exception occurs, EclipseLink will ping the database to determine if the error occurred because the connection is dead. It could be that your ping SQL is failing because it is not correct for your database platform. Try enabling SQL logging to see what the ping SQL is, and try executing this to see if it is valid for your database.

You can change the ping SQL, or disable query retry using a SessionCustomizer

session.getLogin().setPingSQL("Select 1 from Dual");
session.getLogin().setQueryRetryAttemptCount(0);



James : Wiki : Book : Blog : Twitter
Re: Attempting to retry query [message #905304 is a reply to message #904999] Thu, 30 August 2012 06:04 Go to previous message
Igor B is currently offline Igor BFriend
Messages: 9
Registered: July 2012
Junior Member
Hi James,

thank you for your answer.

My JPA is running whithin Weblogic Server 10.3.5. JPA gets the connection from the Connection Pool handled by Weblogic Server. In the Weblogic Server configuration I do have a SQL Statement for checking the database.

I used eclipselink.logging.level=FINEST but I can not see any ping SQL.

So what I found is to use a SessionCustomizer like this:

login.setConnectionHealthValidatedOnError(false);

Like this I get rid of the retry and anyway a potential error is reported.

best regards,

Igor
Previous Topic:preventing on jpa exception setRollbackOnly
Next Topic:Retrieve server generated value
Goto Forum:
  


Current Time: Sat Dec 20 18:43:00 GMT 2014

Powered by FUDForum. Page generated in 0.01614 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software