-->
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.  [ 2 posts ] 
Author Message
 Post subject: My code is haunted
PostPosted: Wed May 23, 2007 10:41 am 
Newbie

Joined: Tue May 22, 2007 10:02 am
Posts: 7
Hi

I am trying to insert some data from a web form into SQL 2005
but instead of inserting the code is updating which is generating an error
any suggestions????

Thanks


Top
 Profile  
 
 Post subject: Re: My code is haunted
PostPosted: Wed May 23, 2007 12:35 pm 
Senior
Senior

Joined: Thu Feb 09, 2006 1:30 pm
Posts: 172
cam978 wrote:
Hi

I am trying to insert some data from a web form into SQL 2005
but instead of inserting the code is updating which is generating an error
any suggestions????

Thanks


Are you using a generated id by any chance? I'm guessing you are generating your primary key values and not specifying the version or unsaved value correctly.

If NHibernate sees that you have an object with an Id which it would think would be an existing key it'll think you want to update (given you called SaveOrUpdate()). If you call Save() it should insert, Update() it should update.

Post your mapping file and classes if you need more help.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.