Session does not giving right records?
Posted
by
Jugal
on Stack Overflow
See other posts from Stack Overflow
or by Jugal
Published on 2012-09-02T14:19:58Z
Indexed on
2012/09/02
21:38 UTC
Read the original article
Hit count: 167
nhibernate
|orm
I want to keep one session, but when I rollback transaction then transaction gets isActive=false, so I can not commit and rollback in next statements by using same transaction. then I need to create new transaction but what is going wrong here ?
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();
Anyone have idea what is going wrong here ? I am not getting deleted object which was rollback.
© Stack Overflow or respective owner