From 5ec2cd79470aeaa8e676dfbe794a63b189349fa2 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 6 Mar 2015 17:45:45 +0100 Subject: [PATCH] AbstractPlatformTransactionManager logs warning for custom isolation level in case of no actual transaction Issue: SPR-12600 --- .../support/AbstractPlatformTransactionManager.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spring-tx/src/main/java/org/springframework/transaction/support/AbstractPlatformTransactionManager.java b/spring-tx/src/main/java/org/springframework/transaction/support/AbstractPlatformTransactionManager.java index 89a25afbdd9..b52d8d8adc4 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/support/AbstractPlatformTransactionManager.java +++ b/spring-tx/src/main/java/org/springframework/transaction/support/AbstractPlatformTransactionManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -385,6 +385,10 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran } else { // Create "empty" transaction: no actual transaction, but potentially synchronization. + if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT && logger.isWarnEnabled()) { + logger.warn("Custom isolation level specified but no actual transaction initiated; " + + "isolation level will effectively be ignored: " + definition); + } boolean newSynchronization = (getTransactionSynchronization() == SYNCHRONIZATION_ALWAYS); return prepareTransactionStatus(definition, null, true, newSynchronization, debugEnabled, null); }