My apologizes for my English.
I have a web application where domain objects are passed to presentation layer as detached object.
The entity A has many eager loaded relations.
When an user want to update datas, an instance of A is saved to http session. The user send updates by several forms. When he decides to commit updates, session.saveOrUpdate is called on instance of A.
It works but requires many useless requests.
I thought I could use lazy loading with merge/evict operations to avoid useless requests.
My idea was the following :
- load an instance of A with least attributes using lazy loading. Cascade attribute is set to All for every relation.
- save the instance to http session
- when the user submits a form
+ set flush mode to MANUAL
+ merge instance
+ update my instance (even lazy loaded relations)
+ evict this instance
+ re set initial flush mode
- when the user commits updates
+ merge instance
+ run business validations process
+ commit session
But it does not work (see :
http://opensource.atlassian.com/project ... l-tabpanel).
It is true that I don't really want to do a merge.
I need to rebind a modified transcient object to an hibernate session in order to access uninitialize relations. But I don't want the modifications to be flushed.
How can I do that?