title: How to load the actual Hibernate entity association and not the LAZY proxy
body: <p>I'm coming from eclipselink and try to work myself through Hibernate.</p>
  
  <p>Lets assume we have a class <code>Car</code> and a class <code>Wheel</code>. The <code>Car</code> class has n wheels. Both entities are connected with a bidirectional association. More importantly on the <code>Wheel</code> side I have a <code>Car</code> reference:</p>
  
  <pre><code>@ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "car_id")
  private Car car;
  </code></pre>
  
  <p>plus a getter.</p>
  
  <p>Now I want to fetch a wheel using its id. From my <code>EntityManager</code> (not a hibernate <code>Session</code>). I initialize the <code>EntityManager</code> like this:</p>
  
  <pre><code>EntityManagerFactory emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
  EntityManager em = emf.createEntityManager();
  </code></pre>
  
  <p>The next step is to fetch a wheel like this:</p>
  
  <pre><code>Wheel wheel = em.find(Wheel.class, 1);
  </code></pre>
  
  <p>The wheel return the wanted class and its fine. Now I want to know which car is the parent of the wheel with something like:</p>
  
  <pre><code>Car car = wheel.getCar();
  </code></pre>
  
  <p>With eclipselink, the actual car would have been loaded. With hibernate a proxy class is loaded instead. </p>
  
  <p>The only solution I worked out so far is to set the FetchType.EAGER or directly fetch join the relationship. What I realized is that the SQL statement in Hibernate is still executed, but no real object delivered. Also after </p>
  
  <pre><code>Hibernate.initalize(car)
  </code></pre>
  
  <p>I cannot retrieve the car entity.</p>
  
  <p>Is there any way to get the expected object back without forming a query or an eager fetch? </p>