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( [hibernate3.jar:]
        at org.hibernate.exception.SQLStateConverter.convert( [hibernate3.jar:]
        at org.hibernate.exception.JDBCExceptionHelper.convert( [hibernate3.jar:]
        at org.hibernate.loader.Loader.doList( [hibernate3.jar:]
        at org.hibernate.loader.Loader.listIgnoreQueryCache( [hibernate3.jar:]
        at org.hibernate.loader.Loader.list( [hibernate3.jar:]
        at org.hibernate.loader.hql.QueryLoader.list( [hibernate3.jar:]
        at org.hibernate.hql.ast.QueryTranslatorImpl.list( [hibernate3.jar:]
        at org.hibernate.engine.query.HQLQueryPlan.performList( [hibernate3.jar:]
        at org.hibernate.impl.SessionImpl.list( [hibernate3.jar:]
        at org.hibernate.impl.QueryImpl.list( [hibernate3.jar:]
        at org.hibernate.ejb.QueryImpl.getResultList( [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();



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 ...