img
void flush();
boolean isCompleted();
}
The methods of the TransactionStatus interface are fairly self-explanatory; the most notable one is
setRollbackOnly(), which causes a rollback and ends the active transaction.
The hasSavePoint() method returns whether the transaction internally carries a save point (i.e., that
transaction was created as a nested transaction based on a save point). The flush() method flushes the
underlying session to a datastore if applicable (e.g., when using with Hibernate). The isCompleted()
method returns whether the transaction has ended (i.e., committed or rolled back).
Sample Data Model and Infrastructure for Example Code
This section provides an overview of the data model and the infrastructure that will be used in the
examples of transaction management.
In this chapter, we will use JPA with Hibernate as the persistence layer for implementing data access
logic. In addition, the Spring Data JPA and its repository abstraction will also be used to simplify basic
database operations development.
Creating a Simple Spring JPA Utility Project with Dependencies
Let's start by creating the project first. Because we are using JPA, create a new Spring template project
and choose Simple Spring JPA Utility Project. Then, enter the project details, as shown in Figure 13-3.
Figure 13-3. Creating a simple Spring JPA utility project in STS
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home