Skip to main content

2016 | Buch

Beginning Hibernate

For Hibernate 5

verfasst von: Joseph B. Ottinger, Jeff Linwood, Dave Minter

Verlag: Apress

insite
SUCHEN

Über dieses Buch

Get started with the Hibernate 5 persistence layer and gain a clear introduction to the current standard for object-relational persistence in Java. This updated edition includes the new Hibernate 5.0 framework as well as coverage of NoSQL, MongoDB, and other related technologies, ranging from applications to big data. Beginning Hibernate is ideal if you’re experienced in Java with databases (the traditional, or connected, approach), but new to open-source, lightweight Hibernate.

The book keeps its focus on Hibernate without wasting time on nonessential third-party tools, so you’ll be able to immediately start building transaction-based engines and applications. Experienced authors Joseph Ottinger with Dave Minter and Jeff Linwood provide more in-depth examples than any other book for Hibernate beginners. They present their material in a lively, example-based manner—not a dry, theoretical, hard-to-read fashion.

What You'll Learn

<Build enterprise Java-based transaction-type applications that access complex data with HibernateWork with Hibernate 5 using a present-day build processUse Java 8 features with HibernateIntegrate into the persistence life cycleMap using Java’s annotationsSearch and query with the new version of HibernateIntegrate with MongoDB using NoSQLKeep track of versioned data with Hibernate Envers

Who This Book Is For

Experienced Java developers interested in learning how to use and apply object-relational persistence in Java and who are new to the Hibernate persistence framework.

Inhaltsverzeichnis

Frontmatter
Chapter 1. An Introduction to Hibernate 5
Abstract
Most significant development projects involve a relational database. The mainstay of most commercial applications is the large-scale storage of ordered information, such as catalogs, customer lists, contract details, published text, and architectural designs.
Joseph B. Ottinger, Jeff Linwood, Dave Minter
Chapter 2. Integrating and Configuring Hibernate
Abstract
Integrating Hibernate into a Java application is easy. The designers of Hibernate avoided some of the more common pitfalls and problems with the existing Java persistence solutions, and created a clean but powerful architecture. In practice, this means that you do not have to run Hibernate inside any particular Java EE container or framework. As of Hibernate 5.2, Java 8 or later is required, thanks to the integration of the date and time API and other such useful features.
Joseph B. Ottinger, Jeff Linwood, Dave Minter
Chapter 3. Building a Simple Application
Abstract
In this chapter, we're going to create the shell of an application, which will allow us to demonstrate a number of concepts common for systems that use Hibernate. We'll be covering the following.
Joseph B. Ottinger, Jeff Linwood, Dave Minter
Chapter 4. The Persistence Life Cycle
Abstract
In this chapter, we discuss the life cycle of persistent objects in Hibernate. These persistent objects can be POJOs without any special marker interfaces or inheritance related to Hibernate. Part of Hibernate’s popularity comes from its ability to work with a normal object model.
Joseph B. Ottinger, Jeff Linwood, Dave Minter
Chapter 5. An Overview of Mapping
Abstract
The purpose of Hibernate is to allow you to treat your database as if it stores Java objects. However, in practice, relational databases do not store objects – they store data in tables and columns. Unfortunately, there is no simple way to correlate the data stored in a relational database with the data represented by Java objects.
Joseph B. Ottinger, Jeff Linwood, Dave Minter
Chapter 6. Mapping with Annotations
Abstract
Mappings can be created in two different ways: via inline annotations (as we’ve done through the book so far), or as separate XML files in one of two primary formats.
Joseph B. Ottinger, Jeff Linwood, Dave Minter
Chapter 7. JPA Integration and Lifecycle Events
Abstract
Hibernate provides a number of capabilities beyond the simple “native Hibernate API.” In this chapter, we are going to discuss using the standard JPA configuration resource, Hibernate’s object validation facilities, and object lifecycle events — along with a few other tricks.
Joseph B. Ottinger, Jeff Linwood, Dave Minter
Chapter 8. Using the Session
Abstract
You may have noticed that the Session object is the central point of access to Hibernate functionality. We will now look at what it embodies and what that implies about how you should use it.
Joseph B. Ottinger, Jeff Linwood, Dave Minter
Chapter 9. Searches and Queries
Abstract
In the last chapter, we discussed how the Hibernate session is used to interact with the database. Some of the session's methods take query strings in their parameter lists or return Query objects. These methods are used to request arbitrary information from the database. In order to fully show how they're used, we must introduce the Hibernate Query Language (HQL), used to phrase these requests. As well as extracting information (with SELECT), HQL can be used to alter the information in the database (with INSERT, UPDATE, and DELETE). We cover all of this basic functionality in this chapter. Note: Hibernate's query facilities do not allow you to alter the database structure.
Joseph B. Ottinger, Jeff Linwood, Dave Minter
Chapter 10. Advanced Queries Using Criteria
Abstract
Hibernate provides three different ways to retrieve data. We have already discussed HQL and the use of native SQL queries; now we add criteria.
Joseph B. Ottinger, Jeff Linwood, Dave Minter
Chapter 11. Filtering the Results of Searches
Abstract
Your application will often need to process only a subset of the data in the database tables. In these cases, you can create a Hibernate filter to eliminate the unwanted data. Filters provide a way for your application to limit the results of a query to data that passes the filter’s criteria. Filters are not a new concept — you can achieve much the same effect using SQL database views or, well, named queries — but Hibernate offers a centralized management system for them.
Joseph B. Ottinger, Jeff Linwood, Dave Minter
Chapter 12. Leaving the Relational Database Behind: NoSQL
Abstract
Hibernate doesn’t limit you to using purely relational databases; Hibernate OGM stands as a project that can carry an object model into the realm of the NoSQL datastore, allowing developers to use a familiar mechanism to access multiple types of storage.
Joseph B. Ottinger, Jeff Linwood, Dave Minter
Chapter 13. Hibernate Envers
Abstract
Hibernate Envers is a project that provides access to entity audit data and versioning and audit data. This means that if you've marked an entity as being audited - via the rather cleverly named @Audited annotation - that Hibernate will track changes made to that entity, and you can access the entity as it's existed through time.
Joseph B. Ottinger, Jeff Linwood, Dave Minter
Backmatter
Metadaten
Titel
Beginning Hibernate
verfasst von
Joseph B. Ottinger
Jeff Linwood
Dave Minter
Copyright-Jahr
2016
Verlag
Apress
Electronic ISBN
978-1-4842-2319-2
Print ISBN
978-1-4842-2318-5
DOI
https://doi.org/10.1007/978-1-4842-2319-2