Skip to content

Commit 0a55998

Browse files
Narossebersole
authored andcommitted
Fixed query-based read-only support during iteration.
1 parent ae2fed4 commit 0a55998

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

hibernate-core/src/main/java/org/hibernate/query/internal/AbstractProducedQuery.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public abstract class AbstractProducedQuery<R> implements QueryImplementor<R> {
9090
private Integer timeout;
9191
private boolean cacheable;
9292
private String cacheRegion;
93-
private boolean readOnly;
93+
private Boolean readOnly;
9494

9595
private LockOptions lockOptions = new LockOptions();
9696

@@ -212,7 +212,10 @@ public QueryImplementor setFetchSize(int fetchSize) {
212212

213213
@Override
214214
public boolean isReadOnly() {
215-
return readOnly;
215+
return ( readOnly == null ?
216+
producer.getPersistenceContext().isDefaultReadOnly() :
217+
readOnly
218+
);
216219
}
217220

218221
@Override
@@ -618,7 +621,7 @@ public QueryImplementor setHint(String hintName, Object value) {
618621
}
619622
else if ( SPEC_HINT_TIMEOUT.equals( hintName ) ) {
620623
// convert milliseconds to seconds
621-
int timeout = (int)Math.round(ConfigurationHelper.getInteger( value ).doubleValue() / 1000.0 );
624+
int timeout = (int)Math.round( ConfigurationHelper.getInteger( value ).doubleValue() / 1000.0 );
622625
applied = applyTimeoutHint( timeout );
623626
}
624627
else if ( AvailableSettings.LOCK_TIMEOUT.equals( hintName ) ) {

0 commit comments

Comments
 (0)