Hi

thanks for your answer,
actually this is in legacy database so their no Id as primary key

waruni

On Mar 9, 7:36 pm, Diego Mijelshon <[email protected]> wrote:
> If you need to change your PK, there's something wrong with the design. What
> generator are you using for the Id?
> Still, if you really need to do that, you're gonna have to do it with plain
> SQL. For example:
>
> session.CreateSQLQuery("update foo set id = :new where id = :old")
> .SetParameter("new", newId)
> .SetParameter("old", id)
> .ExecuteUpdate();
>
> And you also should evict the instance from the session, clear the cache,
> etc.
>
>    Diego
>
>
>
> On Tue, Mar 9, 2010 at 01:52, waruni <[email protected]> wrote:
> > hi,
>
> > i have a problem in nhibernate.
> > I want to change the id ( primary key ) of the object and update it,
> > when im going to change this key i getting nhibernate exception like
> > this:
>
> > NHibernate.StaleObjectStateException: Row was updated or deleted by
> > another transaction (or unsaved-value mapping was incorrect)
>
> > can anyone help me?
>
> > best regards,
> > waruni
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "nhusers" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<nhusers%[email protected]­>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to