Now we are develop a client/server system which use a database server as server and have several client applications. Our client application use hibernate 2.1 as it's OR mapping tools.
The client application is resposible to display and edit data. In this environment we have a DisplaySession for displaying the information of persistent object. When user pikc up a object from GUI, we open an GUI Editor and load object with it's ID though a new EditSession. User can modify the state of this object with this EditSession and decide to submit or cancel the change finally. If user submit it, we just flush and close the EditSession. If user cancel it, we just close the EditSession without flushing. Because we will open several GUI Editors for objects modification, we create a new EditSession for every Editor and close it after Editor closed. So the temporary changes of object state in Editor will not affect the display.
We meet the following problem I can not solve.
Questions:
1. How can I clost a session without flushing?
2. After the changes of persistent object state is persisted in an EditSession, how can I refresh this object in DisplaySession? I can not get the new state of this object after called refresh() method.
3. Sometimes one client need to get the new state of loaded object which has been changed by other client. It's seems that it can not refresh call Session.refresh() method simply.
|