When using declarative demarcation, you specify what transaction demarcation modes should be used around certain areas of code. Rather than implementing these demarcations directly in your code, you declare the demarcations in a configuration file or deployment descriptor. The application server is then responsible for making sure that the correct transactional behavior is used around the specified area.

At present, declarative demarcations are used only for EJBs that use container-managed transactions (CMT). In the ejb-jar.xml deployment descriptor, you declare the transaction-type for the EJB as container, and for each method of the EJB, declare what transaction demarcation mode should be used (using the container-transaction and trans-attribute tags). The application server then makes sure that the declared transaction mode is enacted around the method call.

For example, if an EJB method is declared to have transaction demarcation mode RequiresNew, the application server suspends the current transaction and creates a new one before entering the method, then ends the new transaction and resumes the suspended transaction after exiting the method.

Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices