Direct reference to JPA 2.1 SynchronizationType enum
Issue: SPR-13481
This commit is contained in:
parent
d187cbce73
commit
b6191f6057
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
|
|
@ -36,6 +36,7 @@ import javax.persistence.EntityManager;
|
|||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.Query;
|
||||
import javax.persistence.SynchronizationType;
|
||||
import javax.persistence.spi.PersistenceProvider;
|
||||
import javax.persistence.spi.PersistenceUnitInfo;
|
||||
import javax.sql.DataSource;
|
||||
|
|
@ -444,7 +445,7 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
|||
return method.invoke(this, args);
|
||||
}
|
||||
else if (method.getName().equals("createEntityManager") && args != null && args.length > 0 &&
|
||||
args[0] != null && args[0].getClass().isEnum() && "SYNCHRONIZED".equals(args[0].toString())) {
|
||||
args[0] == SynchronizationType.SYNCHRONIZED) {
|
||||
// JPA 2.1's createEntityManager(SynchronizationType, Map)
|
||||
// Redirect to plain createEntityManager and add synchronization semantics through Spring proxy
|
||||
EntityManager rawEntityManager = (args.length > 1 ?
|
||||
|
|
|
|||
Loading…
Reference in New Issue