how can I achieve flat transaction support with Castor JDO?
See the below classes:
- ClassA.methodA() gets Database and begins transaction,
updates DB, calls ClassB.methodB(), updates DB, then commits
sequentially.
- ClassB.methodB() gets Database, begins transaction, updates DB,
commits.
My question is here: when some exception occured in ClassA.methodA()
after completion of ClassA.MethodA(), in the try-catch block, the
transaction
is getting rollback(). when this happens the changes occured in
ClassA.methodA()
should be rolled back. which is not happening now with Castor JDO.
Am I missing anything?
Class A {
public void methodA() {
Database db = null;
try {
_jdo.getDatabase();
db.begin();
// statements for updating jdo objects using OQL
/* call is made to ClassB.methodB */
(new ClassB()).methodB();
// statements for updating jdo objects using OQL
db.commit();
db.close();
}catch(Exception ex) {
db.rollback(); // this should rollback all the updates within
this method and in ClassB.methodB() method.
db.close();
}
}
}
Class B {
public void methodB() {
Database db = _jdo.getDatabase();
db.begin();
// statements for updating
db.commit();
db.close();
}
}
thanks
venkat
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev