Transactions

To commit multiple statements, group them using transactions.

By default, all database statements are individually committed. For example, if an insert call results in multiple insert statements, then each one gets committed individually. You can, however, use transactions. To group statements inside a transaction, call the beginTransaction() function before the statements, and call commit() after all the statements. Use rollback() to roll back the entire transaction in the event of an exception.

Example

try
{
  Database.setCurrentConnection ("/MyDbConnection");
  Database.beginTransaction ();
  Concept instance=Instance.createInstance("/someconcept");
  Database.insert(instance)
  Database.commit();
}
catch (Exception e)
{
  Database.rollback();
}
finally
{
Database.unsetConnection();
}