I work on a Spring Boot project with Hibernate 5.0. Unfortunately Hibernate reads the lazy initialized objects without throwing LazyInitializationException even after the transaction is committed. How can I enable the LazyInitializationException outside of transactions?
(The current behavior hides bugs in the code.)
EntityManagerwhich is kept open by default for the entire request (see the answer by Babtiste below). Can you elaborate on the "hides bugs" statement? Why is it a bug to be able to call a method that returns a proper result?