MySQL error from a named query

I have a simple named query . We did an upgrade of hibernate libraries and we are seeing the following error . It was working fine in previous version.

Any reason why simple query fails like this ?

    Caused by: org.hibernate.exception.GenericJDBCException: could not execute query
        at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140) [hibernate3.jar:]
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128) [hibernate3.jar:]
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) [hibernate3.jar:]
        at org.hibernate.loader.Loader.doList(Loader.java:2545) [hibernate3.jar:]
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276) [hibernate3.jar:]
        at org.hibernate.loader.Loader.list(Loader.java:2271) [hibernate3.jar:]
        at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:459) [hibernate3.jar:]
        at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:365) [hibernate3.jar:]
        at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196) [hibernate3.jar:]
        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1268) [hibernate3.jar:]
        at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102) [hibernate3.jar:]
        at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:246) [hibernate3.jar:]
        ... 157 more
Caused by: java.sql.SQLException: java.lang.IllegalArgumentException: Negative delay

Hibernate version is 3 and the code is like below

String selectSql = "select m from UserEntity m";
try {
    Query query = entityManager.createQuery(selectSql);
    Collection<UserEntity> userentities = (Collection<UserEntity>) query.getResultList();

}...

Answers


I am encountering the same "Negative delay" exception. Based on my investigation so far, it appears to be due to the JCA layer passing Integer.MAX_VALUE as a query timeout to the MySQL driver. The MySQL driver later mutiplies this by 1000 to convert it into milliseconds, which overflows into a negative value and triggers the "Negative delay" exception when used as a parameter for a java.util.Timer schedule() call. I'm not sure why JBoss is using Integer.MAX_VALUE in the particular scenario where this problem occurs, since I have specified an explicit timeout in the datasource XML configuration. One thing to note is that this problem is only observed after a slave node joins the JBoss cluster. Before that, when only the master node is running, the same workflow that invokes the query completes successfully.


The exact issue seems to be in the way transactions are propagated while making EJB calls using remote EJB client context lookup. If the caller is in a transaction the remote call ends up getting an invalid value, in this case Integer.MAX_VALUE, for transaction timeout in the JTA layer. Therefore when the JCA layer tries to configure transaction timeout based on JTA transaction timeout it ends up passing this huge value to JDBC. I think this is a recent bug in Jboss 6.3 EAP since I haven't seen it in previous versions.


Need Your Help

Function names with symbol characters makes Googling difficult

haskell symbols

In Haskell, many function names contain only symbol characters. Like $$, &gt;&gt;=, &gt;&gt;, :, -&gt;, =&gt;, =~.

How can I compare gps coordinates from text files to see which pair is closest to the user's current location

java android geolocation gps distance

I'm developing an Android app which needs to go through ~100 text files containing pairs of gps coordinates. I need it to return the pair of coordinates closest to the user's current location, but ...