Consistent use of ClassUtils.toClassArray (and related polishing)
This commit is contained in:
@@ -395,11 +395,11 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a proxy of the given EntityManagerFactory. We do this to be able
|
||||
* to return transaction-aware proxies for application-managed
|
||||
* EntityManagers, and to introduce the NamedEntityManagerFactory interface
|
||||
* @param emf EntityManagerFactory as returned by the persistence provider
|
||||
* @return proxy entity manager
|
||||
* Create a proxy for the given {@link EntityManagerFactory}. We do this to be able to
|
||||
* return a transaction-aware proxy for an application-managed {@link EntityManager}.
|
||||
* @param emf the EntityManagerFactory as returned by the persistence provider,
|
||||
* if initialized already
|
||||
* @return the EntityManagerFactory proxy
|
||||
*/
|
||||
protected EntityManagerFactory createEntityManagerFactoryProxy(EntityManagerFactory emf) {
|
||||
Set<Class<?>> ifcs = new LinkedHashSet<Class<?>>();
|
||||
@@ -415,9 +415,8 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
}
|
||||
ifcs.add(EntityManagerFactoryInfo.class);
|
||||
try {
|
||||
return (EntityManagerFactory) Proxy.newProxyInstance(
|
||||
this.beanClassLoader, ifcs.toArray(new Class<?>[ifcs.size()]),
|
||||
new ManagedEntityManagerFactoryInvocationHandler(this));
|
||||
return (EntityManagerFactory) Proxy.newProxyInstance(this.beanClassLoader,
|
||||
ClassUtils.toClassArray(ifcs), new ManagedEntityManagerFactoryInvocationHandler(this));
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
if (entityManagerFactoryInterface != null) {
|
||||
@@ -608,9 +607,8 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
|
||||
|
||||
/**
|
||||
* Dynamic proxy invocation handler proxying an EntityManagerFactory to
|
||||
* return a proxy EntityManager if necessary from createEntityManager()
|
||||
* methods.
|
||||
* Dynamic proxy invocation handler for an {@link EntityManagerFactory}, returning a
|
||||
* proxy {@link EntityManager} (if necessary) from {@code createEntityManager} methods.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
private static class ManagedEntityManagerFactoryInvocationHandler implements InvocationHandler, Serializable {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -231,7 +231,7 @@ public abstract class ExtendedEntityManagerCreator {
|
||||
ifcs.add(EntityManagerProxy.class);
|
||||
return (EntityManager) Proxy.newProxyInstance(
|
||||
(cl != null ? cl : ExtendedEntityManagerCreator.class.getClassLoader()),
|
||||
ifcs.toArray(new Class<?>[ifcs.size()]),
|
||||
ClassUtils.toClassArray(ifcs),
|
||||
new ExtendedEntityManagerInvocationHandler(
|
||||
rawEm, exceptionTranslator, jta, containerManaged, synchronizedWithTransaction));
|
||||
}
|
||||
@@ -427,6 +427,7 @@ public abstract class ExtendedEntityManagerCreator {
|
||||
|
||||
public ExtendedEntityManagerSynchronization(
|
||||
EntityManager em, PersistenceExceptionTranslator exceptionTranslator) {
|
||||
|
||||
super(new EntityManagerHolder(em), em);
|
||||
this.entityManager = em;
|
||||
this.exceptionTranslator = exceptionTranslator;
|
||||
|
||||
Reference in New Issue
Block a user