NHibernate Session 使用总结
1、 Session1 里边通过IQuery查询出一个实体对象(并对此实体对象进行修改),然后在Session1打开的事务里边再次查询这个对应表的对象(包括查询的对象不存在),对应的表就会锁定。Session1里边仍然可以查询表的数据,但打开其它的Session就无法查询了。
2、Session保存一个对象时,在打开的这个Session中,不能查询对应主键ID的对象;如果这样做了,保存对象会提示a different object with the same identifier value was already associated with the session……
1、 Session1 里边通过IQuery查询出一个实体对象(并对此实体对象进行修改),然后在Session1打开的事务里边再次查询这个对应表的对象(包括查询的对象不存在),对应的表就会锁定。Session1里边仍然可以查询表的数据,但打开其它的Session就无法查询了。
2、Session保存一个对象时,在打开的这个Session中,不能查询对应主键ID的对象;如果这样做了,保存对象会提示a different object with the same identifier value was already associated with the session……