i'm trying to change the primary key of an instantited object but i'm getting this exception
Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)
if i change other properties i've no problem
Hibernate version:
1.2.0 Beta 1
Mapping documents:
<?xml version='1.0' encoding='utf-8'?>
<hibernate-mapping xmlns='urn:nhibernate-mapping-2.0'>
<class name='RuredilManager.Impegni, RuredilManager' table='IMPEGNI'>
<composite-id>
<key-property name='UserID' column='IMPUSER' />
<key-property name='AppointmentDatetime' column='IMPDATE' />
<key-property name='Hours' column='IMPHOUR' />
<key-property name='Minutes' column='IMPMINUTE' />
</composite-id>
<version name='Version' column='IMPVERSION' unsaved-value='99' />
<property name='Text' column='IMPTEXT' />
<property name='Owner' column='IMPOWNER' />
<property name='Host' column='IMPHOST' />
<property name='InsertDatetime' column='IMPDATETIME' />
<property name='UpdateOwner' column='IMPUPDOWNER' />
<property name='UpdateHost' column='IMPUPDHOST' />
<property name='UpdateDatetime' column='IMPUPDDATETIME' />
<property name='Attach' column='IMPATTACH' />
<property name='AttachType' column='IMPATTACHTYPE' />
<property name='Description' column='IMPDESC' />
<many-to-one class='RuredilManager.TipiImpegno, RuredilManager' name='AppointmentType' column='IMPTYPE' />
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
this.m_job.UserID = this.m_user.ID;
this.m_job.AppointmentDatetime = this.m_appointment.StartTime;
this.m_job.AppointmentType = this.m_session.Get(typeof(TipiImpegno), int.Parse(cmbTypes.SelectedValue.ToString())) as TipiImpegno;
this.m_job.Description = txtDescription.Text.Trim();
this.m_job.Host = Environment.MachineName;
this.m_job.UpdateHost = Environment.MachineName;
this.m_job.InsertDatetime = DateTime.Now;
this.m_job.UpdateDatetime = DateTime.Now;
this.m_job.Hours = int.Parse(mtxtDuration.Text.Split(new char[] { '.' })[0]);
this.m_job.Minutes = int.Parse(mtxtDuration.Text.Split(new char[] { '.' })[1]);
this.m_job.Owner = Environment.UserName;
this.m_job.UpdateOwner = Environment.UserName;
this.m_job.Text = Encoding.UTF8.GetBytes(rteText.RichTextBox.Rtf.Trim());
this.m_job.Version = 99;
this.m_session.Update(this.m_job);
this.m_session.Flush();
Full stack trace of any exception that occurs:
in NHibernate.Persister.Entity.AbstractEntityPersister.Check(Int32 rows, Object id, Int32 tableNumber, IExpectation expectation, IDbCommand statement) in C:\Documents and Settings\luke\Desktop\NHibernate Beta 1\NHibernate\Persister\Entity\AbstractEntityPersister.cs:riga 619
in NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Object[] oldFields, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session) in C:\Documents and Settings\luke\Desktop\NHibernate Beta 1\NHibernate\Persister\Entity\AbstractEntityPersister.cs:riga 1833
in NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Int32[] dirtyFields, Boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object obj, ISessionImplementor session) in C:\Documents and Settings\luke\Desktop\NHibernate Beta 1\NHibernate\Persister\Entity\AbstractEntityPersister.cs:riga 1734
in NHibernate.Impl.ScheduledUpdate.Execute() in C:\Documents and Settings\luke\Desktop\NHibernate Beta 1\NHibernate\Impl\ScheduledUpdate.cs:riga 63
in NHibernate.Impl.SessionImpl.Execute(IExecutable executable) in C:\Documents and Settings\luke\Desktop\NHibernate Beta 1\NHibernate\Impl\SessionImpl.cs:riga 3283
in NHibernate.Impl.SessionImpl.ExecuteAll(IList list) in C:\Documents and Settings\luke\Desktop\NHibernate Beta 1\NHibernate\Impl\SessionImpl.cs:riga 3262
in NHibernate.Impl.SessionImpl.Execute() in C:\Documents and Settings\luke\Desktop\NHibernate Beta 1\NHibernate\Impl\SessionImpl.cs:riga 3214
in NHibernate.Impl.SessionImpl.Flush() in C:\Documents and Settings\luke\Desktop\NHibernate Beta 1\NHibernate\Impl\SessionImpl.cs:riga 3050
in RuredilManager.frmImpegno.kbConfirm_Click(Object sender, EventArgs e) in C:\Documents and Settings\luke\Desktop\RuredilManager\RuredilManager\frmImpegno.cs:riga 83
in System.Windows.Forms.Control.OnClick(EventArgs e)
in ComponentFactory.Krypton.Toolkit.KryptonButton.OnClick(EventArgs e)
in ComponentFactory.Krypton.Toolkit.KryptonButton.OnButtonClick(Object sender, MouseEventArgs e)
in ComponentFactory.Krypton.Toolkit.ButtonController.OnClick(MouseEventArgs e)
in ComponentFactory.Krypton.Toolkit.ButtonController.MouseUp(Control c, Point pt, MouseButtons button)
in ComponentFactory.Krypton.Toolkit.ViewBase.MouseUp(Point pt, MouseButtons button)
in ComponentFactory.Krypton.Toolkit.ViewBase.MouseUp(Point pt, MouseButtons button)
in ComponentFactory.Krypton.Toolkit.ViewBase.MouseUp(Point pt, MouseButtons button)
in ComponentFactory.Krypton.Toolkit.ViewManager.MouseUp(MouseEventArgs e)
in ComponentFactory.Krypton.Toolkit.VisualControl.OnMouseUp(MouseEventArgs e)
in System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
in System.Windows.Forms.Control.WndProc(Message& m)
in System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
in System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
in System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
in System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
in System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
in System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
in System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
in System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
in System.Windows.Forms.Form.ShowDialog()
in RuredilManager.frmMain._ManageAppointment(ScheduleAppointment Appointment) in C:\Documents and Settings\luke\Desktop\RuredilManager\RuredilManager\frmMain.cs:riga 137
in RuredilManager.frmMain.schMain_AppointmentDoubleClick(Object sender, AppointmentEventArgs e) in C:\Documents and Settings\luke\Desktop\RuredilManager\RuredilManager\frmMain.cs:riga 165
in Janus.Windows.Schedule.Schedule.OnAppointmentDoubleClick(AppointmentEventArgs e)
in Janus.Windows.Schedule.Schedule.y(ScheduleAppointment )
in Janus.Windows.Schedule.JNSAR.a(EventArgs )
in Janus.Windows.Schedule.Schedule.OnDoubleClick(EventArgs e)
in System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
in System.Windows.Forms.Control.WndProc(Message& m)
in System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
in System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
in System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
in System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
in System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
in System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
in System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
in System.Windows.Forms.Application.Run(Form mainForm)
in RuredilManager.Program.Main() in C:\Documents and Settings\luke\Desktop\RuredilManager\RuredilManager\Program.cs:riga 17
in System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
in System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
in Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
in System.Threading.ThreadHelper.ThreadStart_Context(Object state)
in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
in System.Threading.ThreadHelper.ThreadStart()
Name and version of the database you are using: DB2/400
|