You can read about it in the docs here:
http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/mapping.html#mapping-declaration-version
and here:
http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/transactions.html#transactions-optimistic
There might be other solutions for your problem, or you might not want to do
this, but a nice side effect of optimistic concurrency with versioning is
that nhibernate can distinct saved and unsaved entities by the version
number.
On Wed, Apr 1, 2009 at 2:33 PM, DannyT <[email protected]> wrote:

> Thanks for that, I've just been looking at this in the docs, could you
> clarify that this means I need to add a version column to my table and a
> Version property to my entity?
>
> 2009/4/1 Paco Wensveen <[email protected]>
>
>> You can use a "version" int property if you also want optimistic
>> concurrency
>>
>>
>> On 4/1/09, DannyT <[email protected]> wrote:
>>>
>>> We're using GUIDs as our identifier, however our entities may be created
>>> on the server (which we rely on NH to sort out the IDs for) or within a
>>> client application which will generate and assign the ID.
>>>
>>> Currently when trying to save an entity generated from the client app
>>> which will have a GUID but will not already exist in the NH db I get the
>>> error:
>>>
>>> NHibernate.StaleStateException: Unexpected row count: 0; expected: 1
>>>
>>> Should NH not detect the entity doesn't already exist in the database,
>>> despite the fact it has an ID and insert it? Otherwise what else should we
>>> be doing to allow for this?
>>>
>>> Dan
>>>
>>>
>>>
>>
>>
>>
>
>
> --
> http://danny-t.co.uk
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to