Example usage for org.hibernate.annotations QueryHints FETCHGRAPH

List of usage examples for org.hibernate.annotations QueryHints FETCHGRAPH

Introduction

In this page you can find the example usage for org.hibernate.annotations QueryHints FETCHGRAPH.

Prototype

String FETCHGRAPH

To view the source code for org.hibernate.annotations QueryHints FETCHGRAPH.

Click Source Link

Document

Hint providing a "fetchgraph" EntityGraph.

Usage

From source file:fi.vm.sade.eperusteet.repository.custom.PerusteRepositoryImpl.java

License:EUPL

@Override
public Peruste findById(Long id) {
    EntityGraph<Peruste> eg = em.createEntityGraph(Peruste.class);
    eg.addSubgraph(Peruste_.koulutukset);
    eg.addSubgraph(Peruste_.suoritustavat);
    HashMap<String, Object> props = new HashMap<>();
    props.put(QueryHints.FETCHGRAPH, eg);
    Peruste p = em.find(Peruste.class, id, props);
    return p;/*w  ww .j  av a2  s. co  m*/
}