Skip to content

Unnecessary Warning log #254

@geewit

Description

@geewit

Bug Report

Versions

  • Driver:
  • Database:
  • Java:
  • OS:

Current Behavior

Always Warn: H2Connection:294 - Option{name='readOnly', sensitive=false} + isn't supported in H2 at the transaction level. You must set it on conenction URL. See http://www.h2database.com/html/features.html#read_only
// your stack trace here

Table schema

Input Code

io.r2dbc.h2.H2Connection

@OverRide
public Mono beginTransaction(TransactionDefinition definition) {
return useTransactionStatus(inTransaction -> {
if (!inTransaction) {

            IsolationLevel isolationLevel = definition.getAttribute(TransactionDefinition.ISOLATION_LEVEL);
            Boolean readOnly = definition.getAttribute(TransactionDefinition.READ_ONLY);

            Mono<Void> startTransaction = Mono.fromRunnable(() -> this.client.disableAutoCommit());

            if (isolationLevel != null) {
                startTransaction = startTransaction.then(setTransactionIsolationLevel(isolationLevel));
            }

            // THIS:  only readOnly == true then warn
            if (readOnly != null && readOnly) {
                logger.warn(TransactionDefinition.READ_ONLY + " + isn't supported in H2 at the transaction level. " +
                    "You must set it on conenction URL. See http://www.h2database.com/html/features.html#read_only");
            }

            return startTransaction;

        } else {
            this.logger.debug("Skipping begin transaction because already in one");
            return Mono.empty();
        }
    }).onErrorMap(DbException.class, H2DatabaseExceptionFactory::convert);

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions