Java Reference
In-Depth Information
A Spring PlatformTransactionManager , which manages transactions using
the JDO or Hibernate transaction API
A TransactionRetryInterceptor , which is a custom Spring AOP interceptor
that automatically retries a transaction if a database concurrency error
occurs
The domain model-based business logic
As you can see, Spring implements the majority of the transaction and connection
management logic, including the TransactionInterceptor and the servlet filter
for managing persistence framework connections. The only custom infrastructure
code is the TransactionRetryInterceptor .
Let's look at the details. Each servlet handles a request by first invoking the
PlaceOrderService and calling other domain model classes, such as repositories,
to get the data to display. It then forwards the request to a JSP page, which it
Servlet
JSP Page
Spring
OpenPersistence
Manager
InViewFilter
OpenSession
InViewFilter
Transaction
Interceptor
Transaction
Retry
Interceptor
Hibernate/JDO
Transaction
Manager
Domain
Persistence Framework
PlaceOrderService
Connection
Factory
Transaction
Connection
updateDeliveryInfo()
updateRestaurant()
...
begin()
commit ()
Connection open()
close()
Pending
Order
Restaurant
PendingOrder
Repository
Restaurant
Repository
Figure 8.8
Exposed business logic for the Place Order use case
Search WWH ::




Custom Search