File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
spring-orm/src/main/java/org/springframework/orm/jpa/vendor Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2013 the original author or authors.
2
+ * Copyright 2002-2014 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -74,12 +74,21 @@ public void setLazyDatabaseTransaction(boolean lazyDatabaseTransaction) {
74
74
public Object beginTransaction (EntityManager entityManager , TransactionDefinition definition )
75
75
throws PersistenceException , SQLException , TransactionException {
76
76
77
- super .beginTransaction (entityManager , definition );
77
+ UnitOfWork uow = entityManager .unwrap (UnitOfWork .class );
78
+
79
+ if (definition .getIsolationLevel () != TransactionDefinition .ISOLATION_DEFAULT ) {
80
+ // Pass custom isolation level on to EclipseLink's DatabaseLogin configuration
81
+ uow .getLogin ().setTransactionIsolation (definition .getIsolationLevel ());
82
+ }
83
+
84
+ entityManager .getTransaction ().begin ();
85
+
78
86
if (!definition .isReadOnly () && !this .lazyDatabaseTransaction ) {
79
87
// Begin an early transaction to force EclipseLink to get a JDBC Connection
80
88
// so that Spring can manage transactions with JDBC as well as EclipseLink.
81
- entityManager . unwrap ( UnitOfWork . class ) .beginEarlyTransaction ();
89
+ uow .beginEarlyTransaction ();
82
90
}
91
+
83
92
return null ;
84
93
}
85
94
You can’t perform that action at this time.
0 commit comments