-
1. Re: Update Entity on leaving page with a link.
antibrumm.mfrey0.bluewin.ch Nov 2, 2011 1:56 AM (in response to hakanm)Most likely you have conversations with flushmode auto. This is the standard behavior of seam and it generates exactly the issue that you are describing. There are several ways of dealing with this problem. The simplest one would be that you switch to flushmode manual. Then only when you call flush on the entitymanager your changes will be pushed to the db. This solution is ok if you have full control of whats is changing in the entitymanager. If you edit only single entities in a conversation this will be sufficient.
Another way would be to detach the entitites, clone them or wrte an adaptor that holds you changes and push the changes only when you want. This approach would be interessting if you have a multieditor for example. With manual flushmode all the changes would be pushed. Imagine two editors for two entities using the same entitymanager. Now you modify both and click the save button of editor one which will call flush. Both entities are changed and therefore both are commited to the db. If you have for example an adaptor that holds these changes and flush only one adaptor in the save method then only this entity is changed and only one entity is pushed to the db.
Hope this explains it a little.