Hi all,
I want to use an Interceptor to implicitly save the current timestamp and the current user who is logged on and changed the object. So far there is no problem to get the information. I played around with some settings, first of all without an Interceptor. I wanted to know if NHibernate detects which objects have been changed and which not, if I use SaveOrUpdate() for a whole list. Until now I haven't had any success in proving my assumption.
I read through a couple of documentation but I guess I don't get it all by now. So here's what I want (accutally have) ;) to do.
It's a multi-tier web application and it handles everything relatively normal.
1. Recieve a request and retrieve objects
2. Render output, close NHibernate session and store retrieved objects e.g. in HTTP-Session
3. On the next request update stored objects, do some business processing and save or update everything in the database
During this process there is no garanty that all temporarly stored objects were changed. But if every object will be send back to the database the interceptor will overwrite every date and username although the particular object might not have been changed.
What can I do to avoid this problem? As I said I played around with the information abount optimistic locking and versioning stuff but the SQL output didn't indicate any version checking activity. So maybe I'm completely on the wrong track.
Thanks in advance for any hints and suggestions,
Chavez