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

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

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

Query.applyFetchGraph介绍

[英]Apply the given graph using GraphSemantic#FETCH
[中]使用GraphSemantic#FETCH应用给定的图形

代码示例

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

/**
 * Convenience method for {@linkplain Query#getResultList() executing} the Query using the
 * given EntityGraph
 *
 * @param query The JPA Query
 * @param graph The graph to apply
 *
 * @apiNote operates on the assumption that the "default" semantic for an
 * entity graph applied to a Query is {@link GraphSemantic#FETCH}.  This is simply
 * knowledge from JPA EG discussions, nothing that is specifically mentioned or
 * discussed in the spec.
 */
@SuppressWarnings({"unused", "unchecked"})
public static List executeList(Query query, EntityGraph graph) {
  return query.unwrap( org.hibernate.query.Query.class )
      .applyFetchGraph( (RootGraph) graph )
      .list();
}

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

/**
 * Convenience method for {@linkplain Query#getResultList() executing} the Query using the
 * given EntityGraph
 *
 * @param query The JPA Query
 * @param graph The graph to apply
 *
 * @apiNote operates on the assumption that the "default" semantic for an
 * entity graph applied to a Query is {@link GraphSemantic#FETCH}.  This is simply
 * knowledge from JPA EG discussions, nothing that is specifically mentioned or
 * discussed in the spec.
 */
@SuppressWarnings({"unused", "unchecked"})
public static List executeList(Query query, EntityGraph graph) {
  return query.unwrap( org.hibernate.query.Query.class )
      .applyFetchGraph( (RootGraph) graph )
      .list();
}

相关文章