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

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

本文整理了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

  1. /**
  2. * Apply the given graph using {@linkplain GraphSemantic#FETCH fetch semantics}
  3. *
  4. * @apiNote This method calls {@link #applyGraph(RootGraph, GraphSemantic)} using
  5. * {@link GraphSemantic#FETCH} as the semantic
  6. */
  7. default Query<R> applyFetchGraph(RootGraph graph) {
  8. return applyGraph( graph, GraphSemantic.FETCH );
  9. }

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

  1. /**
  2. * Apply the given graph using {@linkplain GraphSemantic#LOAD load semantics}
  3. *
  4. * @apiNote This method calls {@link #applyGraph(RootGraph, GraphSemantic)} using
  5. * {@link GraphSemantic#LOAD} as the semantic
  6. */
  7. default Query<R> applyLoadGraph(RootGraph graph) {
  8. return applyGraph( graph, GraphSemantic.LOAD );
  9. }

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

  1. /**
  2. * Convenience method for {@linkplain Query#getResultList() executing} the Query, applying the
  3. * given EntityGraph using the specified semantic
  4. *
  5. * @param query The JPA Query
  6. * @param graph The graph to apply
  7. * @param semantic The semantic to use when applying the graph
  8. */
  9. @SuppressWarnings("unchecked")
  10. public static List executeList(Query query, EntityGraph graph, GraphSemantic semantic) {
  11. return query.unwrap( org.hibernate.query.Query.class )
  12. .applyGraph( (RootGraph) graph, semantic )
  13. .list();
  14. }

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

  1. /**
  2. * Convenience method for {@linkplain Query#getResultList() executing} the Query, applying the
  3. * given EntityGraph using the named semantic using JPA's "hint name" - see
  4. * {@link GraphSemantic#fromJpaHintName}
  5. *
  6. * @param query The JPA Query
  7. * @param graph The graph to apply
  8. * @param semanticJpaHintName See {@link GraphSemantic#fromJpaHintName}
  9. *
  10. * @return The result list
  11. */
  12. @SuppressWarnings({"unused", "unchecked"})
  13. public static List executeList(Query query, EntityGraph graph, String semanticJpaHintName) {
  14. return query.unwrap( org.hibernate.query.Query.class )
  15. .applyGraph( (RootGraph) graph, GraphSemantic.fromJpaHintName( semanticJpaHintName ) )
  16. .list();
  17. }

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

  1. /**
  2. * Apply the given graph using {@linkplain GraphSemantic#FETCH fetch semantics}
  3. *
  4. * @apiNote This method calls {@link #applyGraph(RootGraph, GraphSemantic)} using
  5. * {@link GraphSemantic#FETCH} as the semantic
  6. */
  7. default Query<R> applyFetchGraph(RootGraph graph) {
  8. return applyGraph( graph, GraphSemantic.FETCH );
  9. }

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

  1. /**
  2. * Apply the given graph using {@linkplain GraphSemantic#LOAD load semantics}
  3. *
  4. * @apiNote This method calls {@link #applyGraph(RootGraph, GraphSemantic)} using
  5. * {@link GraphSemantic#LOAD} as the semantic
  6. */
  7. default Query<R> applyLoadGraph(RootGraph graph) {
  8. return applyGraph( graph, GraphSemantic.LOAD );
  9. }

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

  1. /**
  2. * Convenience method for {@linkplain Query#getResultList() executing} the Query, applying the
  3. * given EntityGraph using the specified semantic
  4. *
  5. * @param query The JPA Query
  6. * @param graph The graph to apply
  7. * @param semantic The semantic to use when applying the graph
  8. */
  9. @SuppressWarnings("unchecked")
  10. public static List executeList(Query query, EntityGraph graph, GraphSemantic semantic) {
  11. return query.unwrap( org.hibernate.query.Query.class )
  12. .applyGraph( (RootGraph) graph, semantic )
  13. .list();
  14. }

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

  1. /**
  2. * Convenience method for {@linkplain Query#getResultList() executing} the Query, applying the
  3. * given EntityGraph using the named semantic using JPA's "hint name" - see
  4. * {@link GraphSemantic#fromJpaHintName}
  5. *
  6. * @param query The JPA Query
  7. * @param graph The graph to apply
  8. * @param semanticJpaHintName See {@link GraphSemantic#fromJpaHintName}
  9. *
  10. * @return The result list
  11. */
  12. @SuppressWarnings({"unused", "unchecked"})
  13. public static List executeList(Query query, EntityGraph graph, String semanticJpaHintName) {
  14. return query.unwrap( org.hibernate.query.Query.class )
  15. .applyGraph( (RootGraph) graph, GraphSemantic.fromJpaHintName( semanticJpaHintName ) )
  16. .list();
  17. }

相关文章