diff --git a/hibernate-entitymanager/src/main/java/org/hibernate/jpa/spi/AbstractQueryImpl.java b/hibernate-entitymanager/src/main/java/org/hibernate/jpa/spi/AbstractQueryImpl.java old mode 100644 new mode 100755 index 0fbc0a80de..f858c489e7 --- a/hibernate-entitymanager/src/main/java/org/hibernate/jpa/spi/AbstractQueryImpl.java +++ b/hibernate-entitymanager/src/main/java/org/hibernate/jpa/spi/AbstractQueryImpl.java @@ -124,10 +124,11 @@ public abstract class AbstractQueryImpl 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" ); }