I am getting the following error when i tried and save my \"Company\" entity in my mvc application
a different object with the same identifier value was alre
I tried @claitonlovatojr's hack, but I couldn't still handle the error.
All I had to do in my case wasy to replace my ISession.Update(obj)
call to ISession.Merge(obj)
.
In your repository, change:
public void Update(Company company)
{
using (ITransaction transaction = _session.BeginTransaction())
{
//_session.Update(company);
_session.Merge(company); // <-- this
transaction.Commit();
}
}
Also, for more information see this answer.