私は、宣言春のトランザクション次を使用します。ここではトランザクションがコミットされているか、宣言的トランザクション管理でロールバックされているかに関わらず、Springでトランザクション情報を取得するにはどうすればよいですか?
<!-- 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"/>
は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;
}
}
私はトランザクション状態すなわちトランザクションがコミットまたはロールバックさについて知りたいです。私はロギングに必要です。
この答えは便利かもしれない:[ログ春のトランザクションを表示] [1] [1]:http://stackoverflow.com/questions/1965454/showing-a-spring-transaction-in-log –