No LazyInitializationException in controller
|Added at||2016-12-22 10:12|
On my project I'm using Spring Boot with Hibernate 5 and Postgresql 9.4. Now I'm facing a problem. I've got a @OneToMany relationship with LAZY fetching. When I try to get this collection outside of a transaction, no exception is thrown. For me that's not a good behavior - I'm expecting LazyInitializationException which is not thrown. Spring Boot project is new and clean. Everything set to default so far.
Here's my code:
Hibernate enable_lazy_load_no_trans property set as default to false. I also tried to enable show-sql and when I debug I can see that hibernate executes SQL selects during company.getStores().get(0).getName() execution. Does anyone know how to pretend this? I want to get a lazy loading exceptions outside of transactions.