if (query.isObjectLevelReadQuery()) {
boolean shouldExtend = valueToApply.equals(javax.persistence.PessimisticLockScope.EXTENDED.name());
ObjectLevelReadQuery olrQuery = (ObjectLevelReadQuery)query;
olrQuery.setShouldExtendPessimisticLockScope(shouldExtend);
if(shouldExtend) {
olrQuery.extendPessimisticLockScope();
}
} else {
throw new IllegalArgumentException(ExceptionLocalization.buildMessage("ejb30-wrong-type-for-query-hint",new Object[]{getQueryId(query), name, getPrintValue(valueToApply)}));
}
return query;