I have a Java thick client application developed using MyEclipse. The application works correctly in the MyEclipse environment but when I extract the code and run it stand alone, I get the following error:
Apr 27, 2007 9:38:02 AM org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 0, SQLState: S1009
Apr 27, 2007 9:38:02 AM org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: Parameter index out of range (7 > number of parameters, which is 6).
Exception in thread "Thread-3" org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2160)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2041)
at org.hibernate.loader.Loader.list(Loader.java:2036)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:95)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at nwa.pds.dao.RawPayrollRecordHome.findFor(RawPayrollRecordHome.java:90)
at nwa.pds.ui.FilterRawPayrollData$FilterRunnable.run(FilterRawPayrollData.java:40)
at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLException: Parameter index out of range (7 > number of parameters, which is 6).
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:2715)
at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:2746)
at com.mysql.jdbc.PreparedStatement.setInt(PreparedStatement.java:2697)
at org.hibernate.loader.Loader.bindLimitParameters(Loader.java:1618)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1557)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2157)
... 8 more
There is a Criteria query being executed which uses setMaxResults. When I remove the setMaxResults, the query works correctly and the above error goes away. Can anyone shed light on this issue, please?
_________________ Phil Hartley
|