camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Strachan <james.strac...@gmail.com>
Subject Re: Camel's @Consume on a @Transactional method
Date Wed, 04 Mar 2009 12:00:05 GMT
Are you dependency injecting the bean using Spring? All Camel does is
get spring to create the bean (along with whatever interceptors for
transactions/security etc).

2009/2/26 Ryan Gardner <ryebrye@gmail.com>:
>
> 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
>



-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Mime
View raw message