J'utilise la suite déclarative transaction Spring:Comment obtenir des informations de transaction au printemps, que la transaction soit validée ou annulée dans une gestion de transaction déclarative?
<!-- Declare a transaction manager-->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" p:sessionFactory-ref="sessionFactory" />
<!-- enable the configuration of transactional behavior based on annotations -->
<tx:annotation-driven transaction-manager="transactionManager" mode="proxy" proxy-target-class="true"/>
Voici le DAO:
@Repository
@Transactional(readOnly = true, propagation=Propagation.REQUIRES_NEW)
@Scope("prototype")
public class Xdao{
public Object getValues(){
.....
}
}
@Service
@Scope("prototype")
public class Xservice{
private Xdao xdao;
public Object getx(){
xdao.getValues();//here I want to know whether the transaction started is
//committed or rollback by aop. Is it possible somehow? I don't want to include that code
//in any service or dao layer.
.........
}
@Autowired
public void setXdao(Xdao xdao){
this.xdao=xdao;
}
}
Je veux savoir sur l'état de transaction transaction i.e. est validée ou annulée. J'en ai besoin pour la journalisation.
Cette réponse pourrait être à portée de main: [Afficher une opération de printemps dans le journal] [1] [1]: http://stackoverflow.com/questions/1965454/showing-a-spring-transaction-in-log –