Spring Persistence with Hibernate

Spring Persistence with Hibernate
eBook: $29.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $79.98    Print cover: $49.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Get to grips with Hibernate and its configuration manager, mappings, types, session APIs, queries, and much more
  • Integrate Hibernate and Spring as part of your enterprise Java stack development
  • Work with Spring IoC (Inversion of Control), Spring AOP, transaction management, web development, and unit testing considerations and features
  • Covers advanced and useful features of Hibernate in a practical way

Book Details

Language : English
Paperback : 460 pages [ 235mm x 191mm ]
Release Date : November 2009
ISBN : 1849510563
ISBN 13 : 9781849510561
Author(s) : Ahmad Seddighi
Topics and Technologies : All Books, Application Development, Java, Open Source
Sorry, the table of contents for this book is not yet available.

Ahmad Seddighi

Ahmad Reza Seddighi is an author, speaker, and consultant in architecting and developing enterprise software systems. He is an IT graduate of the University of Isfahan, Iran, and has ten years of experience in software development. Currently, he lives in Tehran, where he works with a number of small but growing IT companies. He is also the author of three other books: Core Java Programming, Java Web Development, and Open Source J2EE Development, all in Farsi.

Sorry, we don't have any reviews for this title yet.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


- 2 submitted: last submission 10 Dec 2012

Errata type: Typo | Page number: 3 |

For Chapters 14, you should have a basic understanding...... should be: For Chapter 14, you should have a basic understanding.......


Errata type: Code | Page number: 24 |

Configuraion cfg = new Configuration(); should be: Configuration cfg = new Configuration();


Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Spring Persistence with Hibernate +    SOA Patterns with BizTalk Server 2009 =
50% Off
the second eBook
Price for both: $45.60

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Learn the philosophy, the history, and the usage of Persistence
  • Solve problems related to Persistence by gaining a complete understanding of Hibernate
  • Know your competitors and gear yourself to knock down your competition using Hibernate exhaustively
  • Get to know the role of Spring in Persistence and learn to configure Hibernate and Spring
  • Use the essential, most commonly-used Hibernate features such as Transparent persistence, Object-Relational mappings, Object-oriented query language, and more
  • Exploit the optional and advanced Hibernate features to enhance your applications
  • Learn and integrate common Spring features that are a part and parcel of every Java project
  • Make the most out of the Spring features that are related to persistence, particularly to Hibernate
  • Develop sophisticated web applications using Spring Persistence with Hibernate and successfully test them

Here is a brief summary of what each chapter covers:

Chapter 1An Introduction to Hibernate and Spring introduces Spring and Hibernate, explaining what persistence is, why it is important, and how it is implemented in Java applications. It provides a theoretical discussion of Hibernate and how Hibernate solves problems related to persistence. Finally, we take a look at Spring and the role of Spring in persistence.

Chapter 2 - Preparing an Application to Use Spring with Hibernate guides you, step by step, down the path of preparing your application to use Hibernate and Spring. The prerequisites to developing with Hibernate and Spring—getting Hibernate and Spring distributions, setting up a database, and adding extra toolsand frameworks to your application—are all discussed here. 

Chapter 3 - A Quick Tour of Hibernate with Spring provides a quick tour of developing with Hibernate and Spring. Here, a simple example illustrates the basic concepts behind Hibernate and Spring.

Chapter 4Hibernate Configuration shows you how to configure and set up Hibernate. It discusses the basic configuration settings that are always required in any application. (Some optional settings are covered in the book's appendix.)

Chapter 5Hibernate Mappings explains basic issues related to persistent objects and their mappings. It starts with basic mapping concepts and then moves on to advanced and practical issues.

Chapter 6More on Mappings continues the mapping discussion with some advanced mapping topics. It explains how to map complex objects and create complicated mapping files.

Chapter 7Hibernate Types discusses how Hibernate types help to define which Java types are mapped to which SQL database types. It explores the built-in Hibernate types. It also looks at custom type implementation when these built-in types do not satisfy the application's requirements or when you want to change the default behavior of a built-in type.

Chapter 8 - Hibernate Persistence Behavior discusses the life cycle of persistent objects within the application's lifetime. This chapter explains the basic persistence operations provided by the Session API at the heart of the Hibernate API. The chapter also discusses how persistence operations are cascaded between persistent objects and how cascading behavior is defined in mapping files

Chapter 9Querying in Hibernate explains the different approaches that Hibernate provides for querying persistent objects. It investigates HQL, a Hibernate-specific query language; native SQL, a database-relevant query language; and the Criteria API, a Hibernate API to express query statements.

Chapter 10Inversion of Control with Spring starts developing with Spring, introducing the Inversion of Control (IoC) pattern that is implemented at the heart of Spring.

Chapter 11Spring AOP investigates Aspect-Oriented Programming (AOP) as another Spring feature. Here, you'll learn what AOP means, how AOP simplifies application architecture, and how to implement AOP in Spring.

Chapter 12 - Transaction Management discusses transaction management. It explains transaction concepts and how transactions are managed in native and Spring-based Hibernate applications. It also discusses caching as a persistence aspect that involves reliability of data manipulation.

Chapter 13 - Integrating Hibernate with Spring explains how Hibernate and Spring are integrated and introduces the Data Access Object (DAO) pattern. It shows how Spring and Hibernate combine to implement this pattern.

Chapter 14 - Web Development with Hibernate and Spring provides a quick discussion of web development with Spring and Hibernate. It does not provide a detailed discussion of web development; instead, it takes Spring and Struts as sample web frameworks to illustrate how you might use Spring and Hibernate to develop web applications.

Chapter 15Unit Testing looks into testing persistence code, with a focus on unit testing. It introduces JUnit as an open-source unit-testing framework and discusses which aspects of persistence code with Hibernate require testing.

Appendix - Hibernate's Advanced Features looks at some advanced Hibernate topics, including some useful Hibernate properties, the event/listener model implemented by Hibernate, and Hibernate filters.

In Detail

Spring is the leading platform to build and run enterprise Java applications. Spring's Hibernate integration makes it easy to mix and match persistence methodologies simplifying your Hibernate applications. You can incorporate lots of Inversion of Control (IoC) convenience features to address many typical Hibernate integration issues, making this integration all the more favorable for your application.

This easy-to-use book will turn the complex-sounding integration into a straightforward walk-through. Persistence is important for creating a data access-based transactions tier, central to financial, insurance, and banking applications. You will be able to enhance your applications using the most common, advanced, and optional features of Hibernate.

This book starts with the philosophy and the brief history of persistence. It provides an introduction to how persistence frameworks and technologies came into the development scene and what problems they are aimed to solve.

The book continues with a discussion about Hibernate as the most popular persistence framework in Java. First, you will learn how to get Hibernate and add it to a project and how to configure it before it can be used. Next, you will get an in-depth knowledge about Hibernate and understand the essential concepts behind persistence with Hibernate and more. When Hibernate has been fully discussed, you will get to know Spring as another popular framework in Java, and have a look at essential features of Spring and its added value for Hibernate-based projects. Finally the book will provide a comprehensive discussion about using Hibernate with Spring and the problems that are solved with Spring.

This book is a practical guide to learn Hibernate and its features, and integrate it with Spring, discussing how this integration can improve code development, testing, and maintenance.


Spring Persistence with Hibernate is an easy-to-follow, step-by-step, and example-rich guide to using Spring and Hibernate to build robust and effective Java applications. Furthermore, the book can be used as reference in areas where developers need help. All the topics explained in the book are demonstrated with practical examples and uncomplicated figures.

Who this book is for

The book is primarily for Spring developers and users who want to persist using the popular Hibernate persistence framework. Java, Hibernate, JPA, Spring, and open source developers in general will also find the book useful.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software