Ho boy, I bet this question has been answered millions of times, but searching the forums turned up so many irrelevant posts that I gave up.
Basically, when should I use SaveOrUpdate versus Flush?
When I create a new object, I commit it to the database with SaveOrUpdate.
When I update an object, do I use Flush or SaveOrUpdate?
So far I had been using SaveOrUpdate most of the time, but I am worried it is wrong.
Also, when is it pertinent to do a Flush? I'm using NH in a web application and I was wondering if doing a single Flush just at the end of the page processing would be sufficient or there would be situations where it would cause a problem?
Thanks for your help. I am trying to improve the performance of my stuff and I'd like to learn some best practices at the same time.
Alain-Daniel
|