-->
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: Problem with SaveorUpdate(T entity)
PostPosted: Mon Jul 21, 2008 7:15 am 
Newbie

Joined: Mon Jul 21, 2008 7:09 am
Posts: 2
I'm working on a e-commerce site and using nhibernate code to add or edit new products.

When i add new product the SaveOrUpdate(newProduct) function seems to work fine, however, if i try to update existing product, the function doesn't work

Below is my code:

public void btnSave_Click(object sender, EventArgs e)
{
Product newProduct;

if (this.prID.Value == "0")
newProduct = new Product();
else
newProduct = _daoFactory.GetProductDao().GetById(Convert.ToInt32(this.prID.Value), true);

newProduct.Name = Convert.ToString(this.txtName.Text);
newProduct.Description = Convert.ToString(this.txtDescription.Text);
newProduct.Summary = Convert.ToString(this.FreeTextBox1.Text);
newProduct.ProductId = Convert.ToInt32(0);
_daoFactory.GetProductDao().SaveOrUpdate(newProduct);
Response.Redirect("products.aspx");
}

Any kind of help will be appreciated.

Thanks in Advance!

Arshya


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 21, 2008 7:35 am 
Beginner
Beginner

Joined: Wed Sep 21, 2005 8:18 am
Posts: 31
Post it on NHibernate Users forum. This is for Hibernate users forum

_________________
amer sohail


Top
 Profile  
 
 Post subject: Sorry
PostPosted: Mon Jul 21, 2008 7:37 am 
Newbie

Joined: Mon Jul 21, 2008 7:09 am
Posts: 2
Sorry


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.