Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0.1
-
Fix Version/s: 1.1.0
-
Component/s: DSL for Services
-
Labels:None
-
Environment:Tomcat 5.5, Oracle10i
-
Number of attachments :
Description
Since tomcat is not provided with a JTA transactionmanager, overriding the <tx:jta-transaction-manager/> declaration of the applicationContextBase.xml in the applicationContext.xml is wanted. But this does not work.
Only by replacing the <tx:jta-transaction-manager/> declaration in the applicationBaseContext.xml by a specific transactionManager declarantion this can be fixed. For example:
<bean class="org.springframework.orm.hibernate3.HibernateTransactionManager"
id="transactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<!--
<tx:jta-transaction-manager/>
-->
But of course modifying the applicationContextBase.xml does not solve anything, because it will be overwritten by each new code generation activity.
Is this a problem with the Spring overriding mechanism in general, or only for the jta-trxmgr?
Issue Links
| This issue relates to: | ||||
| MODFORJ-117 | Flexible ddl generation |
|
|
|
| MODFORJ-28 | Add enviroment aware switch for transactionManger in Spring configuration |
|
|
|
| MODFORJ-79 | MOD4j should not define the data sources in the Spring Context Definition |
|
|
|
From the Javadoc of BeanFactory (Spring 2.5):
"In contrast to the methods in ListableBeanFactory, all of the operations in this interface will also check parent factories if this is a HierarchicalBeanFactory. If a bean is not found in this factory instance, the immediate parent factory will be asked. Beans in this factory instance are supposed to override beans of the same name in any parent factory. "
The problem with the example in this issue is that the "transactionManager" bean is overridden in a child bean factory (applicationBean.xml) of the bean factory where it is needed (applicationContextBase.txt) by the transactional advice for the services. This at least explains why overriding the transactionManager in the extension point does not work.
A possible work-around is to define all beans that use the overridden "transactionManager" as a child of the versions in the parent context and re-initialize their "transaction-manager" properties.
I will try to find better solutions.