Hi all, i have a problem when i try to update a register in a SQLServer, this is my mapping declaration
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="Galeon.Business.City, Galeon" table="tblCity">
<id name="IdCity" column="idCity" type="Int32" unsaved-value="0">
<generator class="native" />
</id>
<property name="Name" column="name" type="String" />
<property name="CodeDDN" column="codeDDN" type="String" />
<property name="PostalCode" column="postalCode" type="String" />
</class>
</hibernate-mapping>
And when the application execute a SaveOrUpdate method the next error ocurrs:
Code:
Server Error in '/Galeon' Application.
--------------------------------------------------------------------------------
another object with the same id was already associated with the session: [City#3]
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: NHibernate.HibernateException: another object with the same id was already associated with the session: [City#3]
Source Error:
Line 198: {
Line 199: transaction.Rollback();
Line 200: throw;
Line 201: }
Line 202: }
Source File: e:\_usuario\desarrollo\proyectos\galeon\nhibernate\helper\nhibernatehelper.cs Line: 200
Stack Trace:
[HibernateException: another object with the same id was already associated with the session: [City#3]]
NHibernate.Impl.SessionImpl.CheckUniqueness(Key key, Object obj)
NHibernate.Impl.SessionImpl.DoUpdateMutable(Object obj, Object id, IClassPersister persister)
NHibernate.Impl.SessionImpl.DoUpdate(Object obj, Object id, IClassPersister persister)
NHibernate.Impl.SessionImpl.SaveOrUpdate(Object obj)
NHibernate.Helper.Access.SaveOrUpdate(Object item) in e:\_usuario\desarrollo\proyectos\galeon\nhibernate\helper\nhibernatehelper.cs:200
Galeon.Persistent.CityFactory.SaveCity(City city) in e:\_usuario\desarrollo\proyectos\galeon\persistent\cityfactory.cs:46
Galeon.Business.City.Save() in e:\_usuario\desarrollo\proyectos\galeon\business\city.cs:103
Galeon.frmCityProperties.btnSave_Click(Object sender, EventArgs e) in E:\_USUARIO\Desarrollo\Proyectos\Galeon\frmCityProperties.aspx.cs:96
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032
Can anyone help me?
Thanks.
Gustavo
[/code]