O'Reilly logo

Java Persistence with Hibernate, Second Edition by Christian Bauer, Gavin King, and Gary Gregory

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 12. Fetch plans, strategies, and profiles

In this chapter

  • Lazy and eager loading
  • Fetch plans, strategies, and profiles
  • Optimizing SQL execution

In this chapter, we explore Hibernate’s solution for the fundamental ORM problem of navigation, as mentioned in section 1.2.5. We show you how to retrieve data from the database and how you can optimize this loading.

Hibernate provides the following ways to get data out of the database and into memory:

  • Retrieving an entity instance by identifier is the most convenient method when the unique identifier value of an entity instance is known: for example, entityManager.find(Item.class, 123).
  • You can navigate the entity graph, starting from an already-loaded entity instance, by accessing ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required