coolbest wrote:
Say i've got a an object called Request which is persisted to table called RequestTable. First, the web applciation creates an object called Request and saves that to the database. Soon after my windows service application creates an instance of Request and when it tries to save it to the database the error is thrown.
Okay.
You say this is hard to reproduce. So it doesn't happen every time the Service saves the request object?
coolbest wrote:
The log4net worked for a while, but then it just died. Another mystery i just cannot get my head around.
I think it would be important to get this working. Does logging work for either piece (web / service). I don't have any experience with web apps, but I could help with the service, I have many win services in product that use log4net.
coolbest wrote:
In regards to the versions - i'm not sure. Not explicitly, unless NHibernate does that quitly in the background for me.
NHib does not do it for you. In your mapping file, you would specify the version. For instance, in my mapping file, I use:
Code:
<version name="NhVersion" column="nh_version" type="long" unsaved-value="null" />
With this, NHibernate knows whether it has the latest version of an object or if some other application / process has updated the data and it is stale.
So, if two users try to update the same object, the second user will get a "StaleObjectStateException". (Well, I catch the exception and display a friendly message, but you get the idea).
So, my suggestions would be to add a version property to each of your business objects, since you have concurrency issues. And I would try to tackle the issue with log4net so we can see exactly what is happening.