I'm working on Seam project and have following problem - there is an ajax e开发者_开发知识库dit form and many interactions with this form affect (mutate) underlying entity and are changed in db immediately, but I wan't those changes persisted in database only when user will press "save" button. I'm thinking about deataching entity to accomplish this but wonder how (Also looking for smarter solutions).
The changes that you are making to an entity are immediately reflected making it synchronized with database. To detach a entity, you can use entityManager.detach(object)
or entityManager.clear()
, but that will detach all managed entities.
EntityManager's flush-mode is FlushModeType.AUTO
by default, instead try FlushModeType.COMMIT
in which changes are flushed only on explicit commit/flush & then using entityManager.flush()
to synchronize the persistence context to the underlying database.
精彩评论