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 11/*
2- * Copyright 2002-2013 the original author or authors.
2+ * Copyright 2002-2014 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.
@@ -74,12 +74,21 @@ public void setLazyDatabaseTransaction(boolean lazyDatabaseTransaction) {
7474 public Object beginTransaction (EntityManager entityManager , TransactionDefinition definition )
7575 throws PersistenceException , SQLException , TransactionException {
7676
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+
7886 if (!definition .isReadOnly () && !this .lazyDatabaseTransaction ) {
7987 // Begin an early transaction to force EclipseLink to get a JDBC Connection
8088 // so that Spring can manage transactions with JDBC as well as EclipseLink.
81- entityManager . unwrap ( UnitOfWork . class ) .beginEarlyTransaction ();
89+ uow .beginEarlyTransaction ();
8290 }
91+
8392 return null ;
8493 }
8594
You can’t perform that action at this time.
0 commit comments