_carl_ wrote:
In our design we don't evict the entities. We keep the session open during the entire page request. So changes are made by just changing the entities without any explicit calls to an update function in our DAO. And I'm afraid we are to long down the road on this design. Besides we want all changes made during a page request to really be inside one single transaction.
So again, might it be possible to use interceptor (or some other technique) to just begin the transaction when something has changed and its about to be persisted to the database?
What I do is use the Open Session In View pattern to open/close the session, but actually begin a transaction just before calling the SAVE method, and then commit right after it (or rollback, if required). I let NH care of all the different updates it has to do to referenced object inside the one I'm saving.
It' is also true that I don't have (for now) a very complex logic in my pages...