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

Serialize all properties in a class as attributes instead of elements

c# serialization xml-serialization

I'm using XmlSerializer to serialize some classes to a XML File. Suppose I have this class:

Simple function to sort an array of objects

javascript sorting

I would like to create a (non-anonymous) function that sorts an array of objects alphabetically by the key name. I only code straight-out JavaScript so frameworks don't help me in the least.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.