Hello everyone,

I'm currently evaluating using Castor in a Web Application.

The applications uses Data Objects which are held in the HTTPSession. The main problem I am trying to solve is that when two users are working on the same Data Object (e.g. id=2), currently (in my own simple Data Object implementation) the Users do not see the changes of the other User, because the each user has its own copy of that Data Object in the HTTPSession.

Can Castor/JDO solve this problem?

I'm thinking of using the following fragment for loading the Data Object into the Session (only happens once for a new Session):

  db.begin();
  session.setAttribute("data", db.load(Data.class, new Integer(id));
  db.commit();

This fragment is for displaying a view of the Data Object:

  db.begin();
  Data data = (Data) session.getAttribute("data");
  ...use getters on data to read values...
  db.commit();

And this fragment is for someone updating the Data Object:

  db.begin();
  Data data = (Data) session.getAttribute("data");
  ...use setters on data to update values...
  db.update(data);
  db.commit();

It is my understanding that db.load returns different instances even for the same Identities (e.g. id=2), so that the transactions can be isolated against other transactions that can potentially contain operations on the same identity. Is this true?

If someone changes values of one of the instances, the change initially only affects the one transaction.

But then, in the next transaction, the values of the two "identical" Data Objects should be synchronized again, so every view on the data displays the same (updated) values. Is this correct?

Regards,

Andreas

----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev




Reply via email to