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

Reply via email to