-->
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.  [ 3 posts ] 
Author Message
 Post subject: Identity
PostPosted: Tue Apr 04, 2006 9:29 am 
Newbie

Joined: Fri Mar 31, 2006 11:49 am
Posts: 9
Hi everyone :) It's me... again
Here is my Code:
Code:
Rating newRate = new Rating();
newRate.StrRatingName = ratingName.Text;
HiberSessMngr.getSession().Flush();


MyProblem: No changes in the database :(
Object HiberSessMngr id holding a current session, and uts method Flush() doing nothing :(

Why?:( Please show mr my mistakes :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 10:45 am 
Beginner
Beginner

Joined: Tue May 17, 2005 7:25 pm
Posts: 43
Location: Somewhere, USA
You have to tell the session object about our newly created rating object. Assuming the Rating class is mapped properly, you should do this:

Code:
ISession session = HiberSessMngr.getSession();
session.SaveOrUpdate(newRate);
session.Flush();


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 05, 2006 3:25 am 
Newbie

Joined: Fri Mar 31, 2006 11:49 am
Posts: 9
Thanks for your reply :) I fixed my mistakes.
But now I have another one :)
If you familiar with ASP.NET Server Controls, like DataGrid, you probably can help me :)
You see, this DataGrid has do "Edit on Place" feature. I described all the needed commands like EditCommand, CancelCommand and UpdateCommand. When the OnUpdateCommand event occurs, the eventhandler is intercepting it and do come things... BUT! This Eventhandler and this event doing there job as many times as there are records in my DataGrid. Because of this thing my application gets an error about the identity of the object in the cueernt session. So how can update just one recored at a time?

Please help:)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.