By default, a transaction is created and committed for each method call. This is generally not the most efficient way to handle repository item updates. It is generally more efficient if all method calls that create or update a repository item are performed in a single transaction.

The Oracle ATG Web Commerce platform provides several transaction demarcation techniques for grouping repository method calls into a single transaction.

Use the Transaction servlet bean

This servlet bean, described in the ATG Page Developer's Guide, explicitly creates a transaction on a page. For example, the following uses the current transaction, if any exists. If there is no current transaction, one is created before calling the output open parameter, and committed at the end of the droplet:

<droplet bean="/atg/dynamo/transaction/droplet/Transaction">
  <param name="transAttribute" value="required">
  <oparam name="output">

    ... do repository item work ...


JTA (Java Transaction API) lets you explicitly manage the transaction. For example, you might explicitly create a transaction around a repository item creation or update like this:

TransactionManager tm = ...
TransactionDemarcation td = new TransactionDemarcation ();
try {
  try {
    td.begin (tm);

    ... do repository item work ...
  finally {
    td.end ();
catch (TransactionDemarcationException exc) {
  ... handle the exception ...
Use a FormHandler

If you are writing a FormHandler component, you can simply extend the class atg.droplet.TransactionalFormHandler. This FormHandler automatically wraps a transaction around all property get method calls called from a page and another transaction around all property set or handle method calls made from a page. See the Working with Forms and Form Handlers chapter of the ATG Platform Programming Guide for more information.

For detailed information about managing transactions, see the Transaction Management chapter in the ATG Platform Programming Guide.