Hi all,
I've been wrestling with this problem for a while, and don't see a solution. Hope anyone can help me.
I have a HibernateTransactionManager configured. However, I see the following message in the log file:
DEBUG [http-8080-1] AnnotationTransactionAspect.createTransactionIfNec essary(267) | Skipping transactional joinpoint [nl.forestfields.picnic.view.controller.ShoppingLis tController.cashIn] because no transaction manager has been configured
Also, in case of an excpetion, the transaction isn't rolled back.
Here's my configuration:
picnic-servlet.xml:
picnic-context-db.xml:Code:<?xml version="1.0" encoding="UTF-8"?> <beans> <context:component-scan base-package="picnic" /> <context:annotation-config /> <tx:annotation-driven /> . . .
The code the sould be executed inside a transaction:Code:<?xml version="1.0" encoding="UTF-8"?> <beans> <bean class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" id="sessionFactory"> <property name="configLocation" value="classpath:hibernate.cfg.xml" /> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> </props> </property> <property name="dataSource" ref="dataSource" /> </bean> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName"> <value>${hibernate.connection.driver_class}</value> </property> <property name="url"> <value>${hibernate.connection.url}</value> </property> <property name="username"> <value>${hibernate.connection.username}</value> </property> <property name="password"> <value>${hibernate.connection.password}</value> </property> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> </beans>
Can anyone see the problem?Code:@Transactional(rollbackFor=IllegalCostException.class) public ModelAndView cashIn(@RequestParam final Long id) throws IllegalCostException, IllegalOrderStateException, IllegalShoppingListStateException { final ShoppingList shoppingList = shoppingListRepository.getById(id); shoppingList.cashIn(); shoppingListRepository.add(shoppingList); return new ModelAndView(...); }
Cheers,
Jippe


Reply With Quote
