Joined: Sat Mar 10, 2007 12:46 pm Posts: 5
|
|
I get an exception when databinding to a ASP.NET GridView.
The problem is that some of the objects in the datasource are real objects and others are NHibernate Proxy objects.
1) When I first load the page I call ISession session = NHibernateHelper.GetCurrentSession();
ITransaction tx = session.BeginTransaction();
IList items = session.CreateCriteria(typeof(Member)).List();
tx.Commit();
It returns only real objects and databinding is ok!
2) I add a new Member like so:ISession session = NHibernateHelper.GetCurrentSession();
ITransaction tx = session.BeginTransaction();
session.Save(member);
tx.Commit();
3) I call the first method again to get the new list of objects for databinding. Now it returns all the "old" objects as proxies, and the new object as a real object.
Hope someone can help me out - why does this occur?
Hibernate version:1.2.0.3001
|
|