Hello.
I am trying to update an object, but it does not seem to work.
I have tried both short tx and long tx.
Here is the code I am trying to execute:
db.begin();
// Get the email
Email email = (Email) db.load(Email.class,
new Long(emailId), Database.ReadOnly);
db.commit();
db.begin();
// Update the field
email.setIsDeleted(true);
db.update(email);
db.commit();
db.close();
The email object has implemented the TimeStampable interface.
The error I am getting is:
org.exolab.castor.jdo.ObjectModifiedException: Timestamp mismatched!
When I am running it in a short tx:
db.setAutoStore(true);
db.begin();
// Getting the email
Email email = (Email) db.load(Email.class, new Long(emailId), Database.ReadOnly);
// Updating the field
email.setIsDeleted(true);
db.commit();
db.close();
Then the error I am getting is:
org.exolab.castor.jdo.ObjectModifiedException: Transaction aborted:
Object of type foo.bar.Email with identity <id> has been modified by a concurrent transaction
Does anyone have an idea?
Please help.
Thanks in advance.
-- Jonas
- [castor-dev] Problem with updating object jonas_boner
- [castor-dev] Problem with updating object Marcelo Flores A.
