title: Theoretical question on Hibernate Lazy Loading
body: <p>I've learned that Hibernate allows the child elements to be queried only when it's necessary through the use of Lazy Loading.</p>
  
  <p>So if we have:</p>
  
  <pre><code>@Entity
  public class Payment {
  
   ...
  
   @ManyToOne(fetch = FetchType.LAZY)
   private Debtor debtor;
  
  }
  </code></pre>
  
  <p>I expect that when I fetch a Payment from the Database Hibernate set a placeholder in the debtor attribute <strong>and fetches the Debtor only when it's strictly required</strong>.</p>
  
  <p>So if I use a getter method in order to get a Debtor from my Payment Object:</p>
  
  <pre><code>Debtor debtor = payment.getDebtor();
  </code></pre>
  
  <p><strong>I expect the thread blocks until Hibernate performs the SELECT query and return the Debtor object.</strong></p>
  
  <p>So why the heck I always get an <strong>HibernateLazyLoading exception</strong> which obliges me to write a <strong>custom fetch query</strong> in the PaymentRepository, slowing down my initial query <strong>AS I would have used an EAGER FetchType</strong>?</p>
  
  <p>So why does this <code>FetchType.LAZY</code> exists if it doesn't work as naturally expected?</p>