title: Eclipselink: Difference between static and dynamic weaving
body: <p>I use eclipselink 2.6.3 and have the following code:</p>
  
  <pre><code>public Temp getTemp() {
      EntityManager em=emf.createEntityManager();
      String queryString="SELECT a FROM Temp a";
      EntityGraph&lt;Temp&gt; eg = em.createEntityGraph(Temp.class);
      eg.addAttributeNodes("id");
      //eg.addAttributeNodes("name");
      Query query = em.createQuery(queryString);
      query.setHint("javax.persistence.fetchgraph", eg);
      List&lt;Temp&gt; items=query.getResultList();
      em.close();// ENTITYMANAGER IS CLOSED 
      return items.get(0);
  }
  
  public void temp(){
      Temp temp=getTemp();
      System.out.println("id:"+temp.getId());
      System.out.println("name:"+temp.getName());
  }
  </code></pre>
  
  <p><strong>Situation 1:</strong>
  When weaving is static (<code>&lt;property name="eclipselink.weaving" value="static"/&gt;</code> + de.empulse.eclipselink weaving plugin) and we do temp.getName() onemore SQL query is executed and necessary data is loaded. In spite of the fact we did close entity manager. I expected to get exception at temp.getName().</p>
  
  <p><strong>Situation 2:</strong>
  However, when weaving is dynamic (<code>&lt;property name="eclipselink.weaving" value="true"/&gt;</code>) I get exception:</p>
  
  <pre><code>java.lang.ClassNotFoundException: org.eclipse.persistence.internal.jpa.EntityManagerImpl not found by com.temp [57]
  at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1574)
  at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
  at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
  at com.temp.Temp._persistence_checkFetched(Temp2.java)
  at com.temp.Temp._persistence_get_name(Temp2.java)
  at com.temp.Temp.getName(Temp.java:44)
  </code></pre>
  
  <p>How to explain this difference? Is this a bug?</p>