/** * Apply the given graph using {@linkplain GraphSemantic#FETCH fetch semantics} * * @apiNote This method calls {@link #applyGraph(RootGraph, GraphSemantic)} using * {@link GraphSemantic#FETCH} as the semantic */ default Query<R> applyFetchGraph(RootGraph graph) { return applyGraph( graph, GraphSemantic.FETCH ); }
/** * Apply the given graph using {@linkplain GraphSemantic#LOAD load semantics} * * @apiNote This method calls {@link #applyGraph(RootGraph, GraphSemantic)} using * {@link GraphSemantic#LOAD} as the semantic */ default Query<R> applyLoadGraph(RootGraph graph) { return applyGraph( graph, GraphSemantic.LOAD ); }
/** * Convenience method for {@linkplain Query#getResultList() executing} the Query, applying the * given EntityGraph using the specified semantic * * @param query The JPA Query * @param graph The graph to apply * @param semantic The semantic to use when applying the graph */ @SuppressWarnings("unchecked") public static List executeList(Query query, EntityGraph graph, GraphSemantic semantic) { return query.unwrap( org.hibernate.query.Query.class ) .applyGraph( (RootGraph) graph, semantic ) .list(); }
/** * Convenience method for {@linkplain Query#getResultList() executing} the Query, applying the * given EntityGraph using the named semantic using JPA's "hint name" - see * {@link GraphSemantic#fromJpaHintName} * * @param query The JPA Query * @param graph The graph to apply * @param semanticJpaHintName See {@link GraphSemantic#fromJpaHintName} * * @return The result list */ @SuppressWarnings({"unused", "unchecked"}) public static List executeList(Query query, EntityGraph graph, String semanticJpaHintName) { return query.unwrap( org.hibernate.query.Query.class ) .applyGraph( (RootGraph) graph, GraphSemantic.fromJpaHintName( semanticJpaHintName ) ) .list(); }
/** * Apply the given graph using {@linkplain GraphSemantic#FETCH fetch semantics} * * @apiNote This method calls {@link #applyGraph(RootGraph, GraphSemantic)} using * {@link GraphSemantic#FETCH} as the semantic */ default Query<R> applyFetchGraph(RootGraph graph) { return applyGraph( graph, GraphSemantic.FETCH ); }
/** * Apply the given graph using {@linkplain GraphSemantic#LOAD load semantics} * * @apiNote This method calls {@link #applyGraph(RootGraph, GraphSemantic)} using * {@link GraphSemantic#LOAD} as the semantic */ default Query<R> applyLoadGraph(RootGraph graph) { return applyGraph( graph, GraphSemantic.LOAD ); }
/** * Convenience method for {@linkplain Query#getResultList() executing} the Query, applying the * given EntityGraph using the specified semantic * * @param query The JPA Query * @param graph The graph to apply * @param semantic The semantic to use when applying the graph */ @SuppressWarnings("unchecked") public static List executeList(Query query, EntityGraph graph, GraphSemantic semantic) { return query.unwrap( org.hibernate.query.Query.class ) .applyGraph( (RootGraph) graph, semantic ) .list(); }
/** * Convenience method for {@linkplain Query#getResultList() executing} the Query, applying the * given EntityGraph using the named semantic using JPA's "hint name" - see * {@link GraphSemantic#fromJpaHintName} * * @param query The JPA Query * @param graph The graph to apply * @param semanticJpaHintName See {@link GraphSemantic#fromJpaHintName} * * @return The result list */ @SuppressWarnings({"unused", "unchecked"}) public static List executeList(Query query, EntityGraph graph, String semanticJpaHintName) { return query.unwrap( org.hibernate.query.Query.class ) .applyGraph( (RootGraph) graph, GraphSemantic.fromJpaHintName( semanticJpaHintName ) ) .list(); }