title: Using Spring Mono and Hibernate initialize not working
body: <p>I've read many answers here on stackoverflow but still haven't found the best solution to load lazy entities with Spring Mono and JPA/Hibernate.</p>
  
  <p>I can fix it easily by eager fetching but I think that is not the best solution.</p>
  
  <p>My problem now is that I cannot have Hibernate.initialize working either and am looking for a solution. My use case is very simple:</p>
  
  <pre><code>@Transactional
  public Mono&lt;User&gt; getUserById(String id) {
  
      log.debug("Get user by {}", id);
  
      return Mono
              .justOrEmpty(userRepository.findById(id))
              .map(user -&gt; {
                  Hibernate.initialize(user.getCustomer().get());
                  Hibernate.initialize(user.getCustomer().map(Customer::getCustomerSettings).get());
                  return user;
              });
  }
  </code></pre>
  
  <p>The thing is that the Customer is an optional so I don't know if that has any impact on it. 
  I have tested with and without transactional, with and without .get(), and don't have many more ideas of how to solve this the correct way at the moment.</p>
  
  <p>Always get this error:</p>
  
  <pre><code>org.hibernate.LazyInitializationException: could not initialize proxy [com.example.project.customer.model.Customer#692e8725-a5fa-4c87-ac2d-b382b1c6bfbc] - no Session
  </code></pre>
  
  <p>Any ideas?</p>