コード例 #1
0
 @Transactional(TransactionMode.DISABLED)
 @Test
 @UsingDataSet({"profile.yml", "social_connections.yml"})
 public void testEntityGraphs() throws Exception {
   EntityGraph entityGraph = entityManager.createEntityGraph(Profile.class);
   entityGraph.addAttributeNodes("username");
   Map<String, Object> hints = new HashMap<>();
   hints.put("javax.persistence.fetchgraph", entityGraph);
   Profile profile = entityManager.find(Profile.class, 1000L, hints);
   assertEntityGraph(profile);
 }
コード例 #2
0
 @Override
 public <T> void addNamedEntityGraph(String graphName, EntityGraph<T> entityGraph) {
   if (!EntityGraphImpl.class.isInstance(entityGraph)) {
     throw new IllegalArgumentException(
         "Unknown type of EntityGraph for making named : " + entityGraph.getClass().getName());
   }
   final EntityGraphImpl<T> copy = ((EntityGraphImpl<T>) entityGraph).makeImmutableCopy(graphName);
   final EntityGraphImpl old = entityGraphs.put(graphName, copy);
   if (old != null) {
     log.debugf("EntityGraph being replaced on EntityManagerFactory for name %s", graphName);
   }
 }