javax.persistence.EntityManager.createEntityGraph()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(388)

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

EntityManager.createEntityGraph介绍

[英]Return a mutable EntityGraph that can be used to dynamically create an EntityGraph.
[中]返回可用于动态创建EntityGraph的可变EntityGraph。

代码示例

代码示例来源:origin: rapidoid/rapidoid

@Override
public EntityGraph<?> createEntityGraph(String graphName) {
  return em.createEntityGraph(graphName);
}

代码示例来源:origin: rapidoid/rapidoid

@Override
public <T> EntityGraph<T> createEntityGraph(Class<T> rootType) {
  return em.createEntityGraph(rootType);
}

代码示例来源:origin: rapidoid/rapidoid

@Override
public <T> EntityGraph<T> createEntityGraph(Class<T> rootType) {
  return em().createEntityGraph(rootType);
}

代码示例来源:origin: rapidoid/rapidoid

@Override
public EntityGraph<?> createEntityGraph(String graphName) {
  return em().createEntityGraph(graphName);
}

代码示例来源:origin: spring-projects/spring-data-jpa

/**
 * Creates a dynamic {@link EntityGraph} from the given {@link JpaEntityGraph} information.
 *
 * @param em must not be {@literal null}.
 * @param jpaEntityGraph must not be {@literal null}.
 * @param entityType must not be {@literal null}.
 * @return
 * @since 1.9
 */
private static EntityGraph<?> createDynamicEntityGraph(EntityManager em, JpaEntityGraph jpaEntityGraph,
    Class<?> entityType) {
  Assert.notNull(em, "EntityManager must not be null!");
  Assert.notNull(jpaEntityGraph, "JpaEntityGraph must not be null!");
  Assert.notNull(entityType, "Entity type must not be null!");
  Assert.isTrue(jpaEntityGraph.isAdHocEntityGraph(), "The given " + jpaEntityGraph + " is not dynamic!");
  EntityGraph<?> entityGraph = em.createEntityGraph(entityType);
  configureFetchGraphFrom(jpaEntityGraph, entityGraph);
  return entityGraph;
}

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

@Test
//    @Ignore("Cannot run due to Hibernate bug: https://hibernate.atlassian.net/browse/HHH-12696")
  public void testHHH12696MapSubgraphsValueFirst() {
    EntityManager entityManager = getOrCreateEntityManager();
    EntityGraph<GraphParsingTestEntity> graph = entityManager.createEntityGraph( GraphParsingTestEntity.class );
    
    final String mapAttributeName = "map";
    Subgraph<GraphParsingTestEntity> valueSubgraph = graph.addSubgraph( mapAttributeName );
    Subgraph<GraphParsingTestEntity> keySubgraph = graph.addKeySubgraph( mapAttributeName );

    checkMapKeyAndValueSubgraphs( graph, mapAttributeName, keySubgraph, valueSubgraph );
  }
}

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

@Test
//    @Ignore("Cannot run due to Hibernate bug: https://hibernate.atlassian.net/browse/HHH-12696")
  public void testHHH12696MapSubgraphsKeyFirst() {

    EntityManager entityManager = getOrCreateEntityManager();
    EntityGraph<GraphParsingTestEntity> graph = entityManager.createEntityGraph( GraphParsingTestEntity.class );
    
    final String mapAttributeName = "map";
    Subgraph<GraphParsingTestEntity> keySubgraph = graph.addKeySubgraph( mapAttributeName );
    Subgraph<GraphParsingTestEntity> valueSubgraph = graph.addSubgraph( mapAttributeName );

    checkMapKeyAndValueSubgraphs( graph, mapAttributeName, keySubgraph, valueSubgraph );
  }

代码示例来源:origin: org.evolvis.bsi/kolab-ws

@Override
public <T> EntityGraph<T>
createEntityGraph(Class<T> rootType)
{
  return delegate.createEntityGraph(rootType);
}

代码示例来源:origin: kumuluz/kumuluzee

@Override
public <T> EntityGraph<T> createEntityGraph(Class<T> rootType) {
  return em.createEntityGraph(rootType);
}

代码示例来源:origin: org.jboss.eap/wildfly-jpa

@Override
public <T> EntityGraph<T> createEntityGraph(Class<T> rootType) {
  return entityManager.createEntityGraph(rootType);
}

代码示例来源:origin: com.phloc/phloc-db

public EntityGraph <?> createEntityGraph (final String graphName)
{
 return m_aEntityMgr.createEntityGraph (graphName);
}

代码示例来源:origin: org.evolvis.bsi/kolab-ws

@Override
public EntityGraph<?>
createEntityGraph(String graphName)
{
  return delegate.createEntityGraph(graphName);
}

代码示例来源:origin: kumuluz/kumuluzee

@Override
public EntityGraph<?> createEntityGraph(String graphName) {
  return getEntityManager().createEntityGraph(graphName);
}

代码示例来源:origin: com.carecon.fabric3/fabric3-jpa-hibernate

public <T> EntityGraph<T> createEntityGraph(Class<T> rootType) {
  initEntityManager();
  return em.createEntityGraph(rootType);
}

代码示例来源:origin: org.wildfly/wildfly-jpa

public EntityGraph<?> createEntityGraph(String s) {
  long start = 0;
  if (isTraceEnabled)
    start = System.currentTimeMillis();
  try {
    return getEntityManager().createEntityGraph(s);
  } finally {
    if (isTraceEnabled) {
      long elapsed = System.currentTimeMillis() - start;
      ROOT_LOGGER.tracef("createEntityGraph %s took %dms", s, elapsed);
    }
  }
}

代码示例来源:origin: coi-gov-pl/spring-clean-architecture

EntityGraph<PetData> getPetWithOwnerEntityGraph() {
 EntityGraph<PetData> petGraph = entityManager.get()
  .createEntityGraph(PetData.class);
 petGraph.addAttributeNodes(attrs(
  PetData_.ownership
 ));
 addOwnershipSubGraph(petGraph);
 return petGraph;
}

代码示例来源:origin: org.apache.tomee/openejb-core

@Override
public <T> EntityGraph<T> createEntityGraph(final Class<T> rootType) {
  final Timer timer = Op.createEntityGraph.start(this.timer, this);
  try {
    return getEntityManager().createEntityGraph(rootType);
  } finally {
    timer.stop();
  }
}

代码示例来源:origin: katharsis-project/katharsis-framework

protected void applyFetchPaths(Query criteriaQuery) {
  EntityGraph<T> graph = em.createEntityGraph(getEntityClass());
  for (MetaAttributePath fetchPath : fetchPaths) {
    applyFetchPaths(graph, fetchPath);
  }
  criteriaQuery.setHint("javax.persistence.fetchgraph", graph);
}

代码示例来源:origin: org.apache.tomee/openejb-core

@Override
public EntityGraph<?> createEntityGraph(final String graphName) {
  final Timer timer = Op.createEntityGraph.start(this.timer, this);
  try {
    return getEntityManager().createEntityGraph(graphName);
  } finally {
    timer.stop();
  }
}

代码示例来源:origin: org.glassfish.main.common/container-common

@Override
public EntityGraph<?> createEntityGraph(String graphName) {
  try {
    if(callFlowAgent.isEnabled()) {
      callFlowAgent.entityManagerMethodStart(EntityManagerMethod.CREATE_ENTITY_GRAPH_STRING);
    }
    return _getDelegate().createEntityGraph(graphName);
  } finally {
    if(callFlowAgent.isEnabled()) {
      callFlowAgent.entityManagerMethodEnd();
    }
  }
}

相关文章