HHH-8563 - javax.persistence.Query#getLockMode should throw ISE in some cases
This commit is contained in:
parent
0d7854a15d
commit
f79271d60e
|
@ -139,7 +139,16 @@ public abstract class AbstractQueryImpl<X> extends BaseQueryImpl implements Type
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public javax.persistence.LockModeType getLockMode() {
|
public javax.persistence.LockModeType getLockMode() {
|
||||||
getEntityManager().checkOpen( false );
|
checkOpen( false );
|
||||||
|
|
||||||
|
if ( isNativeSqlQuery() ) {
|
||||||
|
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" );
|
||||||
|
}
|
||||||
|
|
||||||
return jpaLockMode;
|
return jpaLockMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue