Transaction Basics

Transactions make it possible to build robust, reliable enterprise applications by controlling the way in which changes are made to the application state. The application state is the state of all of the application’s resources at a given moment in time – what data is stored on disk, in memory, in a database. In a sophisticated application, these resources may be in different processes or on different machines, and a single operation may involve updates to multiple resources. If there is a failure at one point, and the other changes are allowed to succeed, the application’s integrity may be compromised. Transactions solve this problem by ensuring that no updates occur unless they all succeed. If they do, the transaction is committed – that is, updates are made to all participating resources. If one operation fails, then all changes are rolled back to the initial state, and the failure is logged or returned to the user as an error.

A transaction has the properties of atomicity, consistency, isolation, and durability, collectively referred to as ACID properties, described here:

- Atomicity: A transaction is an indivisible unit of work. All changes that a transaction makes to the state of an application are made as one unit; otherwise, all changes are rolled back.

- Consistency: A successful transaction transforms the state of an application from a previous valid state to a new valid state, without violating any integrity constraints.

- Isolation: Any changes that a transaction makes to an application’s state are not visible to other operations until the transaction completes its work.

- Durability: Any changes that a transaction makes to an application’s state will survive future system or media failures.

Transaction management is a fundamental feature of WebLogic Server. For the most part, transactions are managed behind the scenes, but it’s a good idea to be aware of how transactions will happen in your application. For more information on transaction management, see Managing Transactions on e-docs.bea.com (http://e-docs.bea.com/wls/docs70/adminguide/managetx.html).

Related Topics

Default Transactional Behavior in WebLogic Workshop