Bonjour,

J'utilise l'annotation @Transationnal, mais ça ne marche pas. Lorsque je lève une exception, l'insertion en base n'est pas rollbackée.

Voici ma conf Spring :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
<tx:annotation-driven transaction-manager="txManager" />
 
<bean id="txManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
	<property name="sessionFactory" ref="sessionFactory" />
</bean>
 
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
	[... ]
</bean>
Et voici comment j'utilise l'annotation :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
 
@Transactional
@Service
public class AdminServiceImpl implements IAdminService {
 
	@Transactional(rollbackFor=Exception.class)
	@Override
	public void createUser(UserModel user) throws TechnicalException, BusinessException {
		[...}
	}
 
}