Community
Participate
Working Groups
Build Identifier: 2.3.0.v20110604-r9504 The following code throws a MySQLSyntaxErrorException on query.getResultList(): Query query = em.createQuery("SELECT p FROM WorkUnit p WHERE p.worker IS NULL"); query.setLockMode(LockModeType.PESSIMISTIC_FORCE_INCREMENT); query.setMaxResults(workUnitsToGive); List<WorkUnit> workUnits = query.getResultList(); Exception thrown: Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 0, 2' at line 1 Error Code: 1064 Call: SELECT ID AS a1, DATA AS a2, RESULT AS a3, VERSION AS a4, PROJECT_ID AS a5, WORKER_ID AS a6 FROM WORKUNIT WHERE (WORKER_ID IS NULL) FOR UPDATE LIMIT ?, ? bind => [2 parameters bound] I believe that LIMIT ?, ? should come before FOR UPDATE. Reproducible: Always
Setting target and priority. See the following page for the meanings of these fields: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines Community: Please vote for this bug if it is important to you. Votes are one of the main criteria we use to determine which bugs to fix next.
Confirming the bug in 2.6.0.v20140121-d4012b7 Tried also with query.setHint(QueryHints.PESSIMISTIC_LOCK, PessimisticLock.LockNoWait); but got the same invalid SQL. Instead "... FOR UPDATE LIMIT ?, ?" should be "... LIMIT ?, ? FOR UPDATE".
looks like a dup of issue #380101 to which I've just attached a patch
Duplicate of Bug# 380101 *** This bug has been marked as a duplicate of bug 380101 ***
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink