3.5. Session and Transaction Management

Domain classes, once written, can be used similarly to any other Java code, with one exception — code that involves domain objects must be executed within the context of both a session and a transaction.

The session identifies which database that changes are persisted to and queried from, and the transaction allows atomic updates of the database. Setup of the current session and transaction is a simple process that can usually be centrally handled in an application.

Within WAF, session and transaction management is automatically handled by the BaseServlet class. The transaction model used by WAF persistence is a simple extension of common relational database transaction semantics: