I'm trying to use TransactionSynchronizationManager.RegisterSynchron ization();
but I get InvalidOperationException --> TransactionSynchronization is not active.
I wonder in what situation will show this message?
The following is my configuration in my objects.xml
I'm using Spring-2.0.0M2 with NHibernate 3.3 and control whole transaction using TransactionProxyFactoryObject.
Code:
<object id="HibernateTransactionManager" type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate33">
<property name="DbProvider" ref="DbProvider" />
<property name="SessionFactory" ref="SessionFactory" />
</object>
<!--Transaction proxy factory object configuration-->
<object id="TxProxyConfigurationTemplate" abstract="true" type="Spring.Transaction.Interceptor.TransactionProxyFactoryObject, Spring.Data">
<property name="PlatformTransactionManager" ref="HibernateTransactionManager" />
<property name="TransactionAttributes">
<name-values>
<add key="Update*" value="PROPAGATION_REQUIRED" />
<add key="Delete*" value="PROPAGATION_REQUIRED" />
<add key="Create*" value="PROPAGATION_REQUIRED" />
</name-values>
</property>
I try to add this line in my ServiceObject method named CreateDoc()
Code:
TransactionSynchronizationManager.RegisterSynchronization(new IndexHandler(docID));
I turn log4net debug message on and found no line showed "Initializing transaction synchronization".
Seems that HibernateTransactionManager do not call my TransactionSynchronization object.
Please help on this
Thanks.