Package org.hibernate

Interface IdentifierLoadAccess<T>

  • All Known Implementing Classes:
    IdentifierLoadAccessImpl

    public interfaceIdentifierLoadAccess<T>
    Loads an entity by its primary identifier.

    The interface is especially useful when customizing association fetching using anEntityGraph.

     var graph = session.createEntityGraph(Book.class); graph.addSubgraph(Book_.publisher); graph.addPluralSubgraph(Book_.authors)     .addSubgraph(Author_.person); Book book =         session.byId(Book.class)             .withFetchGraph(graph)             .load(bookId);

    It's also useful for loading entity instances with a specificcache interaction mode in effect, or inread-only mode.

     Book book =         session.byId(Book.class)             .with(CacheMode.GET)             .withReadOnly(true)             .load(bookId);
    See Also:
    Session.byId(Class)