Skip to main content
Top

2016 | Book

Spring Persistence with Hibernate

insite
SEARCH

About this book

Learn how to use the core Hibernate APIs and tools as part of the Spring Framework. This book illustrates how these two frameworks can be best utilized. Other persistence solutions available in Spring are also shown including the Java Persistence API (JPA).

Spring Persistence with Hibernate, Second Edition has been updated to cover Spring Framework version 4 and Hibernate version 5. After reading and using this book, you'll have the fundamentals to apply these persistence solutions into your own mission-critical enterprise Java applications that you build using Spring.

Persistence is an important set of techniques and technologies for accessing and using data, and ensuring that data is mobile regardless of specific applications and contexts. In Java development, persistence is a key factor in enterprise, e-commerce, and other transaction-oriented applications. Today, the agile and open source Spring Framework is the leading out-of-the-box, open source solution for enterprise Java developers; in it, you can find a number of Java persistence solutions.

What You'll Learn

How to use Spring Persistence, including using persistence tools in Spring as well as choosing the best Java persistence frameworks outside of SpringHow to work with Spring Framework features such as Inversion of Control (IoC), aspect-oriented programming (AOP), and moreHow to work with Spring JDBC, use declarative transactions with Spring, and reap the benefits of a lightweight persistence strategyHow to work with Hibernate and integrate it into your Spring-based enterprise Java applications for transactions, data processing, and moreHow to integrate JPA for creating a well-layered persistence tier in your enterprise Java applicationWho This Book Is For

This book is ideal for developers interested in learning more about persistence framework options on the Java platform, as well as fundamental Spring concepts. Because the book covers several persistence frameworks, it is suitable for anyone interested in learning more about Spring or any of the frameworks covered. Lastly, this book covers advanced topics related to persistence architecture and design patterns, and is ideal for beginning developers looking to learn more in these areas.

Table of Contents

Frontmatter
Chapter 1. Architecting Your Application with Spring, Hibernate, and Patterns
Abstract
Persistence is typically the lifeblood of an application, providing the long-term memory that software requires in order to be useful across multiple invocations. Despite its importance, the architecture of a persistence tier is rarely granted adequate consideration during the design or implementation stages of an application. The consequences of this lack of planning can be far-reaching and devastating to an organization.
Paul Fisher, Brian D. Murphy
Chapter 2. Spring Basics
Abstract
The Spring Framework has its origins in the companion code for Rod Johnson’s book, Expert One-on-One J2EE Design and Development (Wrox, 2002). The book developed a strong following of developers, who used the Wrox forums to discuss both the book and the corresponding code. Two of those developers, Juergen Hoeller and Yann Caroff, persuaded Rod to turn the code into an open source project. The book referred to the framework as the Interface21 framework, because Rod felt that it represented the future of enterprise Java development—a framework for the twenty-first century. However, when the open source project was formed, they felt they needed a name that could better inspire a community. Yann suggested Spring because of the association with nature, as well as the fact that Spring represented a fresh start after the “winter” of traditional J2EE development. The project went public in 2003, and version 1.0 of the Spring Framework was released in 2004.
Paul Fisher, Brian D. Murphy
Chapter 3. Basic Application Setup
Abstract
In this chapter, we’ll take you on a crash course though setting up a basic project using Spring and Hibernate. The tool we’ll use for managing our application is Apache Maven 3. If you’re already well versed in Spring, Hibernate, and Maven, you may want to just skim through this chapter, so you can get a feel for the structure and conventions we’ll be using throughout the book as we flesh out our media manager application. We’re going to cover a lot of ground very quickly and provide references to the chapters where we dive deeper into the various configurations along the way.
Paul Fisher, Brian D. Murphy
Chapter 4. Persistence with Hibernate
Abstract
Much like Spring, Hibernate changed the software development landscape when it first appeared on the scene. The timing was ideal. Developers were frustrated by the complexity of J2EE and the overhead associated with using EJB for persistence in particular. Hibernate solves the persistence problem through simplicity and clean, thoughtful design.
Paul Fisher, Brian D. Murphy
Chapter 5. Domain Model Fundamentals
Abstract
The domain model is the foundation upon which a persistence tier is constructed. Each domain class defines the properties to be persisted to the database, as well as the relationships between one class and another. This rich object-oriented structure is not easily translated to the relational world of databases. Hibernate provides the required mechanism to help address this impedance mismatch between these two realms.
Paul Fisher, Brian D. Murphy
Chapter 6. Transaction Management
Abstract
Database transactions help you group a set of operations into a single unit of work. All operations either succeed or fail as a group.
Paul Fisher, Brian D. Murphy
Chapter 7. Effective Testing
Abstract
Automated testing, and unit testing in particular, is now universally regarded as a best practice for software development. A number of testing frameworks are available. There remains plenty of room to debate the merits of unit testing versus integration testing; whether to mock objects with frameworks like Mockito or to take a more classic approach with basic stubs; when to apply test-driven development (TDD); whether behavior-driven development (BDD) will become commonplace; and so on.
Paul Fisher, Brian D. Murphy
Chapter 8. Best Practices and Advanced Techniques
Abstract
Throughout this book, you’ve learned a lot about the workings of the Spring and Hibernate frameworks. In this chapter, you will learn the techniques necessary for building a performant, production-ready application. Although Hibernate and Spring are relatively easy to bootstrap, their default settings are appropriate only for simple applications. If you are building an application with significant load or performance requirements, you will likely need to do some fine-tuning in order to attain peak performance. In most scenarios, you can circumvent performance issues simply by leveraging the appropriate optimization or architectural strategies.
Paul Fisher, Brian D. Murphy
Backmatter
Metadata
Title
Spring Persistence with Hibernate
Authors
Paul Fisher
Brian D. Murphy
Copyright Year
2016
Publisher
Apress
Electronic ISBN
978-1-4842-0268-5
Print ISBN
978-1-4842-0269-2
DOI
https://doi.org/10.1007/978-1-4842-0268-5

Premium Partner