You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Claus Ibsen <cl...@gmail.com> on 2009/03/04 12:17:24 UTC

Re: Camel's @Consume on a @Transactional method

Hi Ryan

Did you get a solution to this or any news?


On Thu, Feb 26, 2009 at 4:55 AM, Ryan Gardner <ry...@gmail.com> wrote:
>
> I'm able to use a processor with @Transactional methods called from the DSL
> via beanRef("fooBean", "fooTransactionalMethod") and things work just fine -
> but trying to step a bit away from the DSL to using the annotations to drive
> some of my routes.
>
> I tried doing this:
>
> @Consume(uri = "activemq:newIncident")
> @Transactional(readOnly = false)
> public void handleNewFoo(@Body Foo foo, @Headers Map<String,Object>
> messageHeaders) {
>        ...
> }
>
> and I get this exception:
>
> Caused by: org.hibernate.HibernateException: No Hibernate Session bound to
> thread, and configuration does not allow creation of non-transactional one
> here
>        at
> org.springframework.orm.hibernate3.SpringSessionContext.currentSession(SpringSessionContext.java:63)
>        at
> org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:574)
>        at
> com.digitalbridge.dbdocs.dao.impl.GenericDAOImpl.saveOrUpdate(GenericDAOImpl.java:69)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
>        at
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
>        at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
>        at
> org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:138)
>        ... 21 more
>
> (I'm pretty sure I have the annotation-based @Transactional stuff setup
> correctly...)
>
> Is there some other way to configure this to be both messagedriven and
> transactional?
>
> Ryan
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/