Chapter 9. Integrating portlets with databases

 

This chapter covers

  • Using the Spring JDBC module for data access
  • Addressing cross-cutting concerns using aspect-oriented programming (AOP)
  • Spring’s support for transaction management
  • Working with the Hibernate ORM framework

So far in this book, we’ve looked at portlets that store data in memory. In this chapter, we’ll look at how you can create portlets that interact with databases to store and retrieve data. Because there are multiple mechanisms you can use to integrate a portlet with a database, we’ll focus on widely used frameworks for data access: the Spring JDBC module and the Hibernate ORM (object-relational mapping) framework. Haven’t heard of these or not quite sure how to use them? Keep reading.

In this chapter, we’ll first enhance the non-Spring Book Catalog portlet that we developed in chapter 6 to use the Spring JDBC module, and then we’ll look at how Spring simplifies integration with the Hibernate ORM framework—a Java Persistence API (JPA) provider. In the context of database interaction, we’ll also look at Spring’s support for aspect-oriented programming (AOP) and transaction management.

But let’s first take a quick look at why it’s important to develop portlets that interact with databases.

9.1. Combining portlets and databases

9.2. Exploring the Book Catalog portlet’s database tables

9.3. Spring’s JDBC module for database interaction

9.4. Accessing Spring beans from non-Spring objects

9.5. AOP support in Spring Framework

9.6. Transaction management support in Spring Framework

9.7. Using Hibernate for database interaction

9.8. Summary