HHH-8756 relaxed validation on non select queries when lock mode is set to NONE

This commit is contained in:
Rune Steinseth 2013-11-28 14:20:56 +01:00 committed by Brett Meyer
parent c4c33943f2
commit a32b5dfa74
1 changed files with 4 additions and 3 deletions

View File

@ -124,10 +124,11 @@ public abstract class AbstractQueryImpl<X> extends BaseQueryImpl implements Type
throw new IllegalStateException( "Illegal attempt to set lock mode on a native SQL query" );
}
if ( ! isSelectQuery() ) {
throw new IllegalStateException( "Illegal attempt to set lock mode on a non-SELECT query" );
if ( ! LockModeType.NONE.equals(lockModeType)) {
if ( ! isSelectQuery() ) {
throw new IllegalStateException( "Illegal attempt to set lock mode on a non-SELECT query" );
}
}
if ( ! canApplyAliasSpecificLockModeHints() ) {
throw new IllegalStateException( "Not a JPAQL/Criteria query" );
}