which is the trigger for timestamp ?are you generating the DB with NH or by an external script ? which is the Type of property "UpdatedUtc" ?
2009/2/23 Dcam <[email protected]> > > I've have the following hbm file: > > <?xml version="1.0" encoding="utf-8" ?> > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" > assembly="Proj.Core" namespace="Proj.Core.Entity"> > <class name="Unit" table="Unit" select-before-update="false" > > <id name="Id" column="UniId" type="Int16" unsaved-value="-1"> > <generator class="identity"/> > </id> > <timestamp name="UpdatedUtc" column="UniUpdatedUtc" > generated="always"/> > <property name="Enabled" column="UniEnabled" type="Boolean" > not-null="true"/> > <property name="Name" column="UniName" type="String" not- > null="true" length="30"/> > <property name="Factor" column="UniFactor" type="Double" not- > null="true"/> > </class> > </hibernate-mapping> > > I implemented my project base on Gustavo Ringel's article "uNHAddIns > Persistent Conversation" at > > http://gustavoringel.blogspot.com/2009/02/unhaddins-persistence-conversation-part_08.html > > When I try to save a new Unit object/entity with Id = -1, I get an > StaleObjectStateException with text: "Row was updated or deleted by > another transaction (or unsaved-value mapping was incorrect): > [Proj.Core.Entity.Unit#-1]". The object is saved using > Session.SaveOrUpdate. > > What is wrong with my definition or what do I have to define > differently, so NHibernate recognizes new objects/entities itself, so > I don't have to do it myself an use Session.Save for a new object? > > > -- Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
