Tag: transactions

“该操作对于事务状态”错误和事务范围无效

当我尝试调用包含SELECT语句的存储过程时出现以下错误: 该操作对交易状态无效 这是我的电话结构: public void MyAddUpdateMethod() { using (TransactionScope Scope = new TransactionScope(TransactionScopeOption.RequiresNew)) { using(SQLServer Sql = new SQLServer(this.m_connstring)) { //do my first add update statement //do my call to the select statement sp bool DoesRecordExist = this.SelectStatementCall(id) } } } public bool SelectStatementCall(System.Guid id) { using(SQLServer Sql = new SQLServer(this.m_connstring)) //breaks on this line […]

javax.transaction.Transactional vs org.springframework.transaction.annotation.Transactional

我不明白注释javax.transaction.Transactional和org.springframework.transaction.annotation.Transactional之间的实际区别是什么? org.springframework.transaction.annotation.Transactional是javax.transaction.Transactional的扩展还是完全不同的意思? 什么时候应该每个人都使用? 服务层中的Spring @Transactinal和DAO中的javax ? 谢谢回答。