-->
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.  [ 4 posts ] 
Author Message
 Post subject: about Flush...
PostPosted: Sun Jun 05, 2005 8:37 am 
Newbie

Joined: Fri May 20, 2005 8:23 pm
Posts: 3
I execute the follow statements:

ISession session = Sessions.GetSession();
ICriteria crit = session.CreateCriteria(typeof(PubInfo));
crit.Add(Expression.Like("PrInfo", "%"));
crit.AddOrder(Order.Asc("PubId"));
IList list = crit.List();

DataGrid1.DataSource = list;
DataGrid1.DataBind();

session.Flush(); // here,NHB generate 'Update xxx set xxxx' for every row in IList, Why?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 05, 2005 3:48 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Depends on what the xxx actually is. Probably there was some property that has changed, maybe as a result of loading (like NULL changing to 0 or something like that).


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 05, 2005 8:10 pm 
Newbie

Joined: Fri May 20, 2005 8:23 pm
Posts: 3
the xxx is 'update PubInfo set column_1=@p1....column_n=@pn where ...'

'NULL changing to 0', This is the NHB internal processing, how solves this problem?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 06, 2005 1:57 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
If this is really your problem, then you can either use nullable types (from Nullables in NHibernateContrib package) or write your own usertype that will transform NULL to 0. But first you have to make sure this actually is your problem.


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

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.