Hello,
First a little bit about my environment.
I use the spring-framework 1.1 and have a problem with the transaction management.
I would be able to use both Hibernate and plain JDBC code for the database acess. Both (Hibernate, and JDBC access) are encapsulated in an own written persistence manager. This persistence manager could throw three exceptions ChangesDoNotPersistException, PersistenceInitException and PersistenceException.
Now I want to use the spring transaction manager. I use AOP funcionallity with the TransactionInterceptor.
The persistence manager has a static method (getInstance). And I try to invoke this by this:Code:<bean id="TransactionInterceptor" class="my.TransactionInterceptor"> <property name="transactionManager"> <ref bean="TransactionManager"/> </property> <property name="transactionAttributeSource"> <value>my.PojoService.*User=PROPAGATION_REQUIRED </value> </property> </bean> <bean id="TransactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource"> <ref bean="AwareTransactionDataSource"/> </property> </bean> <bean id="AwareTransactionDataSource" class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy"> <property name="targetDataSource"> <ref bean="DataSource"/> </property> </bean> <bean id="DataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName"> <value>ThinDBPoolDataSource</value> </property> </bean> <bean id="my.UserPojoService" class="org.springframework.aop.framework.ProxyFactoryBean"> <property name="proxyInterfaces"> <value>my.IService</value> </property> <property name="interceptorNames"> <list> <value>TransactionPointcutAdvisor</value> <value>PojoService</value> </list> </property> </bean>
so persistence manager is usable for PojoService.Code:<bean id="PojoService" class="my.PojoService"> <property name="persistenceManager"> <ref bean="PersistenceManager"/> </property> <property name="baseLogger"> <ref bean="BaseLogger"/> </property> </bean> <bean id="PersistenceManager" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> <property name="staticMethod"> <value>my.PersistenceManagerFactory.getInstance</value> </property> </bean>
During runtime:
When transaction beans are created on startup I get a lot of these messages:
so I think the Transaction manager is configured well and tries to catch those Exceptions.Code:INFO; ; 2004-09-15 14:31:52,778; org.springframework.transaction.interceptor.MethodMapTransactionAttributeSource;Message: Adding transactional method [public void my.PojoService.createUser(my.Data data) throws my.PersistenceException,my.PersistenceInitException,my.ChangesNotPersistedException] with attribute [PROPAGATION_REQUIRED,ISOLATION_DEFAULT];
But the result is that the Exceptions are not catched and the application did a crash.
Is something wrong with my configuration?Code:my.ChangesNotPersistedException: Hibernate Exception: at my.HibernatePersister.store(HibernatePersister.java:124) at my.PersistenceManagerImpl.store(PersistenceManagerImpl.java:208) at my.UserServiceImpl.createUser(UserServiceImpl.java:96) ...
Without transaction manager directly over the persistenc manager everything runs well.
Did I have to use metadata compilation in my case?
How could I resolve this problem.
Thanks for reply


Reply With Quote