Chapter 9: Using Hibernate in Spring Applications


In the previous chapter you saw how to use JDBC in Spring applications. However, even though Spring goes a long way toward simplifying JDBC development, you still have a lot of code to write.

In this chapter, we are going to take a look at one of the object-relational mapping (ORM) frameworks that has wide support in Spring—Hibernate.

Hibernate started off as an independent project, but it became part of JBoss. This proves that Hibernate is indeed a robust and fast framework that can bring a rapid application development (RAD) approach to DAO implementations.

Just like any other RAD tool, with Hibernate, there is a tradeoff between ease of use and speed and low-level features you can access. As you will see, Hibernate performs adequately and offers enough features to manipulate the data, even from its high-level APIs.

In particular, we are going to discuss the following topics:

Configuration: We are going to discuss the various configuration files you need to successfully use Hibernate in your data access layer.

Creating mapping files: You need to create these mapping files to tell Hibernate how to map the tables in your database to the domain objects. We are going to discuss mappings that represent the various table relationships.

CRUD operations: You will learn how to effectively select data from the database using outer joins wherever possible and how to insert data to the database and make sure Hibernate sets the correct value of the primary key to the inserted domain object. Finally, you will learn how to effectively implement optimistic concurrency in data updates.

Pro Spring
Pro Spring
ISBN: 1590594614
EAN: 2147483647
Year: 2006
Pages: 189

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: