The spec specifically says that javax.persistence.Query#setLockMode
should throw an IllesgalStateException when called on a query that
represents a native query. Our implementation has not done that
historically since we do have (to varying degrees) the ability to apply
locking to the SQL.
However the 2.1 TCK is checking this and we are failing because we do
not throw the IllesgalStateException :(
So I changed up our impl to throw the IllesgalStateException to pass the
TCK. I did add a new query hint to allow users who might be relying on
this to keep on trucking. So instead of:
Query q = em.createNative( query );
// this is what is illegal
q.setLockMode( theLockMode );
users would need to do:
Query q = em.createNative( query );
q.setHint( QueryHints.NATIVE_LOCKMODE, theLockMode );
Just an FYI...
Show replies by date