Question
I saw spring.jpa.open-in-view=true
property in Spring Boot documentation for
JPA configuration.
- Is the
true
default value for this property if it's not provided at all?; - What does this really do? I did not find any good explaining for it;
- Does it make you use
SessionFactory
instead ofEntityManagerFactory
? If yes, how can I tell it to allow me to useEntityManagerFactory
instead?
Thanks!
Answer
This property will register an OpenEntityManagerInViewInterceptor
, which
registers an EntityManager
to the current thread, so you will have the same
EntityManager
until the web request is finished. It has nothing to do with a
Hibernate SessionFactory
etc.