Fixed query-based read-only support during iteration.

This commit is contained in:
Chris Cranford 2016-04-24 00:01:49 -05:00 committed by Steve Ebersole
parent 76bac3268a
commit 993e308e96
1 changed files with 6 additions and 3 deletions

View File

@ -90,7 +90,7 @@ public abstract class AbstractProducedQuery<R> implements QueryImplementor<R> {
private Integer timeout; private Integer timeout;
private boolean cacheable; private boolean cacheable;
private String cacheRegion; private String cacheRegion;
private boolean readOnly; private Boolean readOnly;
private LockOptions lockOptions = new LockOptions(); private LockOptions lockOptions = new LockOptions();
@ -212,7 +212,10 @@ public abstract class AbstractProducedQuery<R> implements QueryImplementor<R> {
@Override @Override
public boolean isReadOnly() { public boolean isReadOnly() {
return readOnly; return ( readOnly == null ?
producer.getPersistenceContext().isDefaultReadOnly() :
readOnly
);
} }
@Override @Override
@ -618,7 +621,7 @@ public abstract class AbstractProducedQuery<R> implements QueryImplementor<R> {
} }
else if ( SPEC_HINT_TIMEOUT.equals( hintName ) ) { else if ( SPEC_HINT_TIMEOUT.equals( hintName ) ) {
// convert milliseconds to seconds // convert milliseconds to seconds
int timeout = (int)Math.round(ConfigurationHelper.getInteger( value ).doubleValue() / 1000.0 ); int timeout = (int)Math.round( ConfigurationHelper.getInteger( value ).doubleValue() / 1000.0 );
applied = applyTimeoutHint( timeout ); applied = applyTimeoutHint( timeout );
} }
else if ( AvailableSettings.LOCK_TIMEOUT.equals( hintName ) ) { else if ( AvailableSettings.LOCK_TIMEOUT.equals( hintName ) ) {