Skip to content

Commit a32b5df

Browse files
runeksbrmeyer
authored andcommitted
HHH-8756 relaxed validation on non select queries when lock mode is set to NONE
1 parent c4c3394 commit a32b5df

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

hibernate-entitymanager/src/main/java/org/hibernate/jpa/spi/AbstractQueryImpl.java

100644100755
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,11 @@ public TypedQuery<X> setLockMode(javax.persistence.LockModeType lockModeType) {
124124
throw new IllegalStateException( "Illegal attempt to set lock mode on a native SQL query" );
125125
}
126126

127-
if ( ! isSelectQuery() ) {
128-
throw new IllegalStateException( "Illegal attempt to set lock mode on a non-SELECT query" );
127+
if ( ! LockModeType.NONE.equals(lockModeType)) {
128+
if ( ! isSelectQuery() ) {
129+
throw new IllegalStateException( "Illegal attempt to set lock mode on a non-SELECT query" );
130+
}
129131
}
130-
131132
if ( ! canApplyAliasSpecificLockModeHints() ) {
132133
throw new IllegalStateException( "Not a JPAQL/Criteria query" );
133134
}

0 commit comments

Comments
 (0)