Part III. Building applications and Architecture

Table of Contents

12. Data Access Objects
Best practices and DAO
Data Access Objects DAO
Weaving the application structure
Paper book order
eBook order
Defining the application layers
DAO and DaoFactory
Creating DAOs with generics
13. Session and Transaction Handling
Hibernate Session
JTA versus JDBC Transactions
Transaction handling – default pattern
JDBC transactions with ThreadLocal
JTA transaction with a single database
JDBC or JTA with the Spring framework
Conversations and Session Lifetime
Short life of a session
Lifetime until the view is rendered (Open-Session-in-View)
Long life of a session
Concurrent Access
Optimistic Locking
14. Integration with other technologies
Hibernate and Spring
Use of the Spring template
Alternative approach (nicer)
Transaction handling
Hibernate and Struts
Optimistic locking
Exception handling