In our project we propose to have wrappers (adapters) to the session facade layer so that we expose a POJO API to the external app. users. My question is related to synchronization of the POJO objects that the API users will use, and the remote objects exposed through the session facade. For instance if an API user were to call some setters on a POJO object (like User object), which just sets these properties locally, and then finally call oUser.Update(). If the Update were to fail the object state in the DB and the local copy would be out of synch. There are some possibilities that we have explored: 1. Save the state of the local object before calling setters and if the remote call fals restore the state. 2. Have the Update take a DTO which is used to transfer the state to the session layer. If that succeedes then reflect that state in the loacl object too. 3. After each Update reload the state from the session facade, failing which restore the saved state somehow. (we will still need to store state) The problem I assme is not related to EJB. Even if we were going through JDBC such a problem would exist. What is the standard best practice to take care of such a scenario??
Joined: Mar 18, 2004
I haven't seen a single reply to this question. Could someone pl. shed some light on this issue. Would really appreciate it.