Over a million developers have joined DZone.

'High-Performance Java Persistence' Chapter 8: Why JPA and Hibernate Matter

In chapter 8 of his book 'High-Performance Java Persistence,' Vlad Mihalcea breaks down the importance of JPA and Hibernate. Check out the chapter summary with this great overview.

· Performance Zone

Evolve your approach to Application Performance Monitoring by adopting five best practices that are outlined and explored in this e-book, brought to you in partnership with BMC.

Second Part, Chapter 8

Now that the first part of my book is published, it’s time to focus on the second part, which covers both JPA and Hibernate. From now on, every new chapter is going to be released right after it’s completed, so the reader doesn’t have to wait for the whole part to be finished to get access to new chapters.

Table of Contents

This chapter aims to remind the reader why Hibernate has its place in high-performance data access, and the table of content looks like this:

8. Why JPA and Hibernate matter
8.1 The impedance mismatch
8.2 JPA vs Hibernate
8.3 Schema ownership
8.4 Write-based optimizations
8.5 Read-based optimizations
8.6 Wrap-up

Chapter Summary

In this chapter you will learn that the object-relation impedance mismatch is inevitable when building an enterprise system on top of an OOP language. JPA can reduce this gap, but only when used properly.

You will also learn that there are two schemas that need to stay in sync at all times: the Domain Model Entity hierarchy and the database schema. If the business logic drives the application evolution, the database system owns both the data and the schema itself, and the Domain Model must adapt to this relational model.

Another interesting topic is the fear of portability which might lead to discarding high-performance related features of both the underlying database system or the data access framework. As explained, portability doesn’t imply reducing access to common features only. One can achieve portability using feature specialization as well.

Hibernate is great for writing data. It comes with a transnational write-behind cache that can delay modifying statements from acquiring locks early. It can provide transparent batching and a solid base for implementing application-level concurrency control mechanisms.

When reading data, the application developer must take into consideration the purpose of the data being fetched. Entities are great for synchronizing changes, while projections are better suited for read-only views.

Enjoy reading it, and I am looking forward to getting your feedback.

Learn tips and best practices for optimizing your capacity management strategy with the Market Guide for Capacity Management, brought to you in partnership with BMC.

Topics:
performance ,java ,java persistence ,jpa ,hibernate

Published at DZone with permission of Vlad Mihalcea, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}