These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: When proxy and when real object?
PostPosted: Sat Mar 10, 2007 12:53 pm 
Newbie

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.