First page Back Continue Last page Graphics


Notes:

Business Components Transactions (continued)

When a root application module contains other nested application modules, they all participate in the root application module’s transaction and share the same database connection and a single set of entity caches. This sharing is handled for you automatically by the root application module and its Transaction object. You should keep this transaction context in mind when designing the application. If you want separate transactions, do not nest the application modules.

For example, you may have an InventoryManagerAM application module that has methods to add or subtract from inventory. It would make sense to nest this application module inside a customer-facing ShoppingAM. When the customer submits an order, you could subtract the ordered items from the inventory as a part of the same transaction. If the commit fails, the order does not get submitted, and inventory changes are rolled back as well. It would not make sense, however, for you to nest the inventory management application module inside one that manages human resources. HR transactions, such as hiring or salary changes, should be completely separate transactions from inventory management.