This bug is the same as HHH-10885, except for NamedQueries and NamedNativeQueries instead of NativeQueries
The problem is that the position (ordinal paramer) in Query.setParameter(int, Object) is zero based. JPA 2.1 spec states that the ordinal parameters should be 1-based.
This works (but shouldn't)
This causes IllegalArgumentExceptions , but should work
A workaround is to use specific positions in the statement (e.g. ... where id = ?1 instead of ... where id = ? )
Arquillian test case is attached (can be run with mvn verify )
I believe this affects all Hibernate 5 versions (tested with 5.1.0.Final, 5.2.0.Final and 5.2.2.Final)
OSX 10.9 / Windows 7