Attempting to retry query [message #904528] |
Tue, 28 August 2012 16:01 |
Igor B 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 626 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 |
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03670 seconds