Java Mailing List Archive

http://www.junlu.com/

Home » user.castor »

[castor-user] Load and update obligatory in the same transaction?

Andras Hatvani

2010-03-26

Replies: Find Java Web Hosting

Author LoginPost Reply
Hi,

I'm new to Castor and I'm part of this semester's development team of the course Advanced Software Engineering on the Vienna University of Technology.
During the development with Castor the following question arose for me: Why must the load and the updating of an object be in the same transaction?

Example:
1) WORKS
db.begin();
loadedPerson = db.load(Person.class, id);
loadedPerson.setFirstName(FIRST_NAME_2);
db.commit();

2) DOESN'T WORK
db.begin();
loadedPerson = db.load(Person.class, id);
db.commit();

db.begin();
loadedPerson.setFirstName(FIRST_NAME_2);
db.commit();

In the second case the persisted values remained the same.

Thanks,
Andras Hatvani


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


©2008 junlu.com - Jax Systems, LLC, U.S.A.