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:
parent
bb399fc79d
commit
20851907c2
1 changed files with 26 additions and 0 deletions
|
@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue