I'm sure it's a bug, because I only update NHibernate dll's and now I'm getting this error, so I post here before jira, to know if someone already got it.
Simply, if the update statement is generated (in case of insert it works!) all many to one fields are added to the update clause even I set the update=false attribute in the <many-to-one> tag.
With previous NH version still works fine
Hibernate version:
1.2.0GA
Mapping documents:
<?xml version='1.0' encoding='utf-8'?>
<hibernate-mapping xmlns='urn:nhibernate-mapping-2.2'>
<class name='CUP.Domain.ReservationDetail, CUP.Domain' table='RIGHEPRENOTAZIONI' dynamic-update='true'>
<composite-id>
<key-property name='Year' column='PREANN' />
<key-property name='Number' column='PRENUM' />
<key-property name='DetailRow' column='PRERIG' />
</composite-id>
<version name='Version' column='PRERVE' unsaved-value='0' />
<property name='Document' column='PRERIC' />
<property name='ReservationDate' column='PREDAT' />
<property name='Hour' column='PREORA' />
<property name='Minute' column='PREMIN' />
<property name='MainCategoryID' column='PRESPKEY' />
<property name='DiagnosticID' column='PREDIACOD' />
<property name='PerformanceTypeID' column='PRETPRCOD' />
<property name='ExamID' column='PREARKEY' />
<property name='InsertUser' column='PREUID' />
<property name='InsertDateTime' column='PREDID' />
<property name='UpdateUser' column='PREUMD' />
<property name='UpdateDateTime' column='PREDMD' />
<property name='CancelUser' column='PREUED' />
<property name='CancelDateTime' column='PREDED' />
<property name='AccessUser' column='PREUVD' />
<property name='AccessDateTime' column='PREDVD' />
<property name='PrintUser' column='PREUSD' />
<property name='PrintDateTime' column='PREDSD' />
<property name='CancelCode' column='PRERNU' />
<property name='RowType' column='PRETYP' />
<many-to-one class ='CUP.Domain.Exam, CUP.Domain' name ='Exam' insert='false' update='false' not-found='ignore'>
<column name='PRESPKEY'/>
<column name='PREDIACOD'/>
<column name='PRETPRCOD'/>
<column name='PREARKEY'/>
</many-to-one>
<many-to-one class ='CUP.Domain.ReservationHeader, CUP.Domain' insert='false' update='false' name ='ParentHeader' not-found='ignore'>
<column name ='PREANN'/>
<column name ='PRENUM'/>
</many-to-one>
<many-to-one class='CUP.Domain.Diagnostic, CUP.Domain' name='Diagnostic' insert='false' update='false' not-found='ignore'>
<column name='PRESPKEY'/>
<column name='PREDIACOD'/>
</many-to-one>
<many-to-one class='CUP.Domain.Availability, CUP.Domain' name='Availability' insert ='false' update='false' not-found='ignore'>
<column name='PRESPKEY'/>
<column name='PREDIACOD'/>
<column name='PRETPRCOD'/>
<column name='PREDAT'/>
<column name='PREORA'/>
<column name='PREMIN'/>
</many-to-one>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
SaveOrUpdate
Full stack trace of any exception that occurs:
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 NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Int32[] dirtyFields, Boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object obj, ISessionImplementor session)
in NHibernate.Impl.ScheduledUpdate.Execute()
in NHibernate.Impl.SessionImpl.Execute(IExecutable executable)
in NHibernate.Impl.SessionImpl.ExecuteAll(IList list)
in NHibernate.Impl.SessionImpl.Execute()
in NHibernate.Impl.SessionImpl.Flush()
in CUP.frmReservation.kbConfirm_Click(Object sender, EventArgs e) in C:\Documents and Settings\luke\Desktop\CUP\CUP\frmReservation.cs:riga 250
Name and version of the database you are using:
Oracle 10g
The generated SQL (show_sql=true):
could not update: [CUP.Domain.ReservationDetail#CUP.Domain.ReservationDetail][SQL: UPDATE RIGHEPRENOTAZIONI SET PRERVE = ?, PRESPKEY = ?, PREDIACOD = ?, PRETPRCOD = ?, PREARKEY = ?, PREANN = ?, PRENUM = ?, PRESPKEY = ?, PREDIACOD = ?, PRESPKEY = ?, PREDIACOD = ?, PRETPRCOD = ?, PREDAT = ?, PREORA = ?, PREMIN = ? WHERE PREANN = ? AND PRENUM = ? AND PRERIG = ? AND PRERVE = ?]
|