public class DefaultSelectorPersistenceAnnotationBeanPostProcessor
extends org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor
EntityManagerFactory
s in Spring, the PersistenceContext
without unit name will cause problems,
since base libraries assume a single PersistenceContext
, this will cause all base libraries to throw
a NoUniqueBeanDefinitionException
that encounter a unitNameless EntityManager
.PersistenceAnnotationBeanPostProcessor
when searching a default,
it will default to either the Spring bean id (using a default PersistenceContext) should prefix the factory name to it OR the first one defined in the configs.Constructor and Description |
---|
DefaultSelectorPersistenceAnnotationBeanPostProcessor() |
Modifier and Type | Method and Description |
---|---|
protected javax.persistence.EntityManagerFactory |
findDefaultEntityManagerFactory(String requestingBeanName)
Find a single default EntityManagerFactory in the Spring application context.
|
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) |
findEntityManagerFactory, findNamedEntityManagerFactory, getOrder, getPersistenceContext, getPersistenceUnit, lookup, postProcessAfterInitialization, postProcessAfterInstantiation, postProcessBeforeDestruction, postProcessBeforeInitialization, postProcessBeforeInstantiation, postProcessMergedBeanDefinition, postProcessPropertyValues, requiresDestruction, setDefaultPersistenceUnitName, setExtendedPersistenceContexts, setJndiEnvironment, setJndiTemplate, setOrder, setPersistenceContexts, setPersistenceUnits, setResourceRef
public DefaultSelectorPersistenceAnnotationBeanPostProcessor()
protected javax.persistence.EntityManagerFactory findDefaultEntityManagerFactory(String requestingBeanName) throws org.springframework.beans.factory.NoSuchBeanDefinitionException
findDefaultEntityManagerFactory
in class org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor
org.springframework.beans.factory.NoSuchBeanDefinitionException
- if there is no single EntityManagerFactory in the contextpublic void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
setBeanFactory
in interface org.springframework.beans.factory.BeanFactoryAware
setBeanFactory
in class org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor
Copyright © 2018. All rights reserved.