13.1. Defining the global fetch plan
Retrieving persistent objects from the database is one of the most interesting parts of working with Hibernate.
13.1.1. The object-retrieval options
Hibernate provides the following ways to get objects out of the database:
Navigating the object graph, starting from an already loaded object, by accessing the associated objects through property accessor methods such as aUser.getAddress().getCity(), and so on. Hibernate automatically loads (and preloads) nodes of the graph while you call accessor methods, if the persistence context is still open.
Retrieval by identifier, the most convenient method when the unique identifier value of an object is known.
The Hibernate Query Language (HQL), which is a full object-oriented ...
Get Java Persistence with Hibernate now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.