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.