Implement res.commit() and res.abort() methods.

res.commit() commits all changes to DB and starts a new transaction.
res.abort() aborts the current transaction and request.
This commit is contained in:
hns 2005-01-25 15:59:14 +00:00
parent bb399fc79d
commit 20851907c2

View file

@ -16,6 +16,8 @@
package helma.framework; package helma.framework;
import helma.objectmodel.db.Transactor;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
@ -436,4 +438,28 @@ public class ResponseBean implements Serializable {
return res.popStringBuffer(); return res.popStringBuffer();
} }
/**
* Commit changes made during the course of the current transaction
* and start a new one
*
* @throws Exception
*/
public void commit() throws Exception {
if (Thread.currentThread() instanceof Transactor) {
Transactor tx = (Transactor) Thread.currentThread();
String tname = tx.getTransactionName();
tx.commit();
tx.begin(tname);
}
}
/**
* Abort the current transaction by throwing an Error
*
* @throws AbortException
*/
public void abort() throws AbortException {
throw new AbortException();
}
} }