Red Hat Web Application Framework 6.1: WAF Developer Guide | ||
---|---|---|
Prev | Chapter 2. WAF Component: Persistence | Next |
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:
Transactions cannot be nested.
Once a transaction begins it must either be committed or rolled back.
Transactions must be rolled back after an error occurs.