overridden @PersistenceContext annotations on subclass methods are being processed correctly (SPR-8594)

This commit is contained in:
Juergen Hoeller
2011-08-12 13:54:17 +00:00
parent b9ebdd28fb
commit 49e61d2680
2 changed files with 45 additions and 4 deletions

View File

@@ -27,7 +27,6 @@ import java.util.LinkedList;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.PersistenceContext;
@@ -384,7 +383,7 @@ public class PersistenceAnnotationBeanPostProcessor
for (Method method : targetClass.getDeclaredMethods()) {
PersistenceContext pc = method.getAnnotation(PersistenceContext.class);
PersistenceUnit pu = method.getAnnotation(PersistenceUnit.class);
if (pc != null || pu != null &&
if ((pc != null || pu != null) &&
method.equals(ClassUtils.getMostSpecificMethod(method, clazz))) {
if (Modifier.isStatic(method.getModifiers())) {
throw new IllegalStateException("Persistence annotations are not supported on static methods");