PDA

View Full Version : MySQL + Spring.NET + NHibernate - Problems with Transactions



Fagoter
02-13-2007, 04:33 PM
Hello Gays
I Have A problem, I'm using My Sq + lSpring.NET + NHibernate;
A performed standart HibernateTransation Manager Support by AOP in
Spring Context, and when store some to DB, I catch exception:
System.InvalidOperationException: No value for key [NHibernate.Impl.SessionFactoryImpl] bound to thread [TestRunnerThread]
at Spring.Transaction.Support.TransactionSynchronizat ionManager.UnbindResource(Object key)
at Spring.Data.NHibernate.HibernateTransactionManager .DoCleanupAfterCompletion(Object transaction)
at Spring.Transaction.Support.AbstractPlatformTransac tionManager.cleanupAfterCompletion(DefaultTransact ionStatus status)
at Spring.Transaction.Support.AbstractPlatformTransac tionManager.ProcessRollback(DefaultTransactionStat us status)
at Spring.Transaction.Support.AbstractPlatformTransac tionManager.Rollback(ITransactionStatus transactionStatus)
at Spring.Objects.ObjectUtils.InvokeMethod(MethodInfo method, Object instance, Object[] arguments)
at Spring.Aop.Framework.ReflectiveMethodInvocation.In vokeJoinpoint()
at Spring.Aop.Framework.AbstractMethodInvocation.Proc eed()
at eShop.Aop.Interceptors.TestInterceptor.Invoke(IMet hodInvocation invocation) in D:\Work\.NET\Diplom\Project\Aop\Aop\Aop\Intercepto rs\TestInterceptor.cs:line 24
at Spring.Aop.Framework.AbstractMethodInvocation.Proc eed()
at Spring.Aop.Framework.DynamicProxy.AdvisedProxy.Inv oke(Object proxy, Object target, Type targetType, MethodInfo targetMethod, Object[] args, IList interceptors)
at Spring.Proxy.CompositionAopProxy_3393a86ca076443f8 900656062511cea.Rollback(ITransactionStatus transactionStatus)
at Spring.Transaction.Interceptor.TransactionAspectSu pport.DoCloseTransactionAfterThrowing(TransactionI nfo transactionInfo, Exception exception)

Fagoter
02-13-2007, 04:33 PM
Please Help Me with that - Thanks

snelson
02-13-2007, 07:37 PM
Can you provide the configuration files you're using along with your code which is invoking the transaction. Also if you use [ code ] [ /code ](without the spaces between brackets) you get nicely formatted source code.

Cheers

Stephen

Fagoter
02-14-2007, 08:30 AM
<object id="myTransactionManager" type="Spring.Data.NHibernate.HibernateTransactionManager , Spring.Data.NHibernate12">
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactory" ref="mySessionFactory"/>
</object>

<object id="UserDaoTarget" type="eShop.Dao.Impl.UserDao, Dao">
<property name="SessionFactory">
<ref object="mySessionFactory"/>
</property>
</object>

<object id="TxProxyConfigurationTemplate" abstract="true" type="Spring.Transaction.Interceptor.TransactionProxyFac toryObject, Spring.Data">

<property name="PlatformTransactionManager" ref="myTransactionManager"/>

<property name="TransactionAttributes">
<name-values>
<!-- Add common methods across your services here -->
<add key="Update*" value="PROPAGATION_REQUIRED"/>
<add key="Store*" value="PROPAGATION_REQUIRED"/>
<add key="Remote*" value="PROPAGATION_REQUIRED"/>
</name-values>
</property>
</object>

<object id="UserDao" parent="TxProxyConfigurationTemplate">
<property name="Target" ref="UserDaoTarget"/>
</object>

Erich Eichinger
02-14-2007, 08:47 AM
Hi,

please download the latest build and retry - your problem might have to do with a bug I recently fixed.

I this doesn't help, please turn on full file-based logging (e.g. using log4net) including timestamp, thread-id, loggername & message and email me the log.

How does your app.config look like? Are you working in a ASP.NET environment?

tx,
Erich