Skip to content

Commit d467dc2

Browse files
committed
Avoid double getFlushMode call
1 parent 24b9e3a commit d467dc2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/HibernateTransactionManager.java

Lines changed: 2 additions & 2 deletions
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-2016 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.
@@ -480,7 +480,7 @@ protected void doBegin(Object transaction, TransactionDefinition definition) {
480480
if (!definition.isReadOnly() && !txObject.isNewSession()) {
481481
// We need AUTO or COMMIT for a non-read-only transaction.
482482
FlushMode flushMode = session.getFlushMode();
483-
if (session.getFlushMode().equals(FlushMode.MANUAL)) {
483+
if (FlushMode.MANUAL.equals(flushMode)) {
484484
session.setFlushMode(FlushMode.AUTO);
485485
txObject.getSessionHolder().setPreviousFlushMode(flushMode);
486486
}

spring-orm-hibernate5/src/main/java/org/springframework/orm/hibernate5/HibernateTransactionManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 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.
@@ -477,7 +477,7 @@ protected void doBegin(Object transaction, TransactionDefinition definition) {
477477
if (!definition.isReadOnly() && !txObject.isNewSession()) {
478478
// We need AUTO or COMMIT for a non-read-only transaction.
479479
FlushMode flushMode = session.getFlushMode();
480-
if (session.getFlushMode().equals(FlushMode.MANUAL)) {
480+
if (FlushMode.MANUAL.equals(flushMode)) {
481481
session.setFlushMode(FlushMode.AUTO);
482482
txObject.getSessionHolder().setPreviousFlushMode(flushMode);
483483
}

0 commit comments

Comments
 (0)