Skip to content

Commit 5ec2cd7

Browse files
committed
AbstractPlatformTransactionManager logs warning for custom isolation level in case of no actual transaction
Issue: SPR-12600
1 parent 71cdf85 commit 5ec2cd7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

spring-tx/src/main/java/org/springframework/transaction/support/AbstractPlatformTransactionManager.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -385,6 +385,10 @@ else if (definition.getPropagationBehavior() == TransactionDefinition.PROPAGATIO
385385
}
386386
else {
387387
// Create "empty" transaction: no actual transaction, but potentially synchronization.
388+
if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT && logger.isWarnEnabled()) {
389+
logger.warn("Custom isolation level specified but no actual transaction initiated; " +
390+
"isolation level will effectively be ignored: " + definition);
391+
}
388392
boolean newSynchronization = (getTransactionSynchronization() == SYNCHRONIZATION_ALWAYS);
389393
return prepareTransactionStatus(definition, null, true, newSynchronization, debugEnabled, null);
390394
}

0 commit comments

Comments
 (0)