I have the following situation:
1. There is a complex graph of objects with all kinds of relations mapped to the database.
2. There is an abstract viewer(s), which receives a domain object and may display any data by navigating the links. We don't know beforehand which data the viewer may need/request.
3. There are editors which allow the user creating/modifying some objects. Editors have preview buttons which shall open the viewer but not persist the changes.
Question: Is it possible to prevent N/Hibernate from persisting the changes keeping the object persistent at the same time (to allow the viewers pull any data they need from the database)?
Additional complexity: Each editor and viewer has its own session. So, the editor shall detach the object and the viewer shall re-attach it to another session.
I purposely don't give much details. I have several working solutions for each small piece of the problem, but in a whole, I don't have a nice approach which satisfies me. I want some abstract/academic/architectural/generic (don't know how to call it) solutions or ideas.
|