我想保留一个会话,但是当我回滚事务时,事务得到 isActive=false,所以我不能使用相同的事务在下一个语句中提交和回滚。那么我需要创建新的交易,但这里出了什么问题?
var session = NHibernateHelper.OpenSession();/* It returns new session. */
var transaction1 = session.BeginTransaction();
var list1 = session.Query<Make>().ToList(); /* It returs 4 records. */
session.Delete(list1[2]);
/* After Rollback, transaction is isActive=false so I can not commit
* and rollback from this transaction in future. so I need to create new transaction.
*/
transaction1.Rollback();
var transaction2 = session.BeginTransaction();
/* It returns 3 records.
* I am not getting object(which was deleted but after that rollback) here why ?
*/
var list2 = session.Query<Make>().ToList();
有人知道这里出了什么问题吗?我没有得到已删除的回滚对象。