-->
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.  [ 1 post ] 
Author Message
 Post subject: Problem when update a register
PostPosted: Mon Aug 22, 2005 9:28 am 
Newbie

Joined: Thu Aug 18, 2005 4:07 pm
Posts: 2
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]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.