org.hibernate.query.Query.applyGraph()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(200)

本文整理了Java中org.hibernate.query.Query.applyGraph方法的一些代码示例,展示了Query.applyGraph的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.applyGraph方法的具体详情如下:
包路径:org.hibernate.query.Query
类名称:Query
方法名:applyGraph

Query.applyGraph介绍

[英]Apply the given graph using the given semantic
[中]使用给定的语义应用给定的图形

代码示例

代码示例来源:origin: hibernate/hibernate-orm

/**
 * 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 );
}

代码示例来源:origin: hibernate/hibernate-orm

/**
 * 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 );
}

代码示例来源:origin: hibernate/hibernate-orm

/**
 * 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();
}

代码示例来源:origin: hibernate/hibernate-orm

/**
 * 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();
}

代码示例来源:origin: org.hibernate.orm/hibernate-core

/**
 * 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 );
}

代码示例来源:origin: org.hibernate.orm/hibernate-core

/**
 * 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 );
}

代码示例来源:origin: org.hibernate.orm/hibernate-core

/**
 * 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();
}

代码示例来源:origin: org.hibernate.orm/hibernate-core

/**
 * 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();
}

相关文章