I am utilizing Spring 3.0.5 with Hibernate 3.6/JPA 2.0. I am using orm files and persistence.xml files, with annotations for wiring in the EntityManager (so I am utilizing PersistenceAnnotationBeanPostProcessor).
In one of my wars, I have about 4 different EntityManagers for different data sources. These entity managers utilize LocalContainerEntityManagerFactoryBean with JNDI backed datasources. We have probably around 100+ DAO classes that are annotated with Repository.
I configure the PersistenceExceptionTranslationPostProcessor by putting the bean registration in my class:
As the application starts:Code:<!-- Exception translation bean post processor --> <bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
The war is now up to 2000+ instances of the previous messages in the log files.Code:2012-06-29 08:54:45,896 [[ACTIVE] ExecuteThread: '32' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'foo1EntityManagerFactory' 2012-06-29 08:54:45,896 [[ACTIVE] ExecuteThread: '32' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'foo2EntityManagerFactory' 2012-06-29 08:54:45,896 [[ACTIVE] ExecuteThread: '32' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'foo3EntityManagerFactory' 2012-06-29 08:54:45,896 [[ACTIVE] ExecuteThread: '32' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'foo4EntityManagerFactory' 2012-06-29 08:54:45,897 [[ACTIVE] ExecuteThread: '32' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#859' 2012-06-29 08:54:45,897 [[ACTIVE] ExecuteThread: '32' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#860' 2012-06-29 08:54:45,897 [[ACTIVE] ExecuteThread: '32' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating instance of bean 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#860' 2012-06-29 08:54:45,900 [[ACTIVE] ExecuteThread: '32' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#860' to allow for resolving potential circular references
Is there something I could be doing wrong to give this recursive nature to the PersistenceExceptionTranslationPostProcessor?
----------------------------------------------------------------------------------------
I did want to add one item...we pull together multiple jars into a single war and in doing that...we may have multiple DAOs and their Spring Context files being merged into a single war. So if we have multiple context files that each are defining:
<!-- Exception translation bean post processor -->
<bean class="org.springframework.dao.annotation.Persiste nceExceptionTranslationPostProcessor"/>
Does that mean for each context file it will instantiate a new instance of this PersistenceExceptionTranslationPostProcessor? And that will scan the artifacts for the @Resource (for each isntance)?


Reply With Quote
