• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

Synchronization of objects state

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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??
 
A Teja
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't seen a single reply to this question. Could someone pl. shed some light on this issue. Would really appreciate it.
 
Get off me! Here, read this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!