transactionRollback (Database - Java)

Discards database changes recorded by transactionBegin.

Defined in

Database

Syntax

Database.transactionRollback();

Usage

transactionRollback can be called only after transactionBegin.

Note: For important information about using transaction methods, see Effects of using transaction controls.

Example

try {
   Session session = getSession();
   AgentContext ac = session.getAgentContext();
   Database db = session.getDatabase("myserver", "mydb.nsf");
   db.transactionBegin();
   Document doc = db.createDocument();
   doc.replaceItemValue("Form", "Memo");
   doc.replaceItemValue("Subject", "TestDoc");
   doc.save();
   db.transactionRollback();
   } catch(Exception e) {
	e.printStackTrace();
}