I have a Spring Boot project which uses hibernate via the JPA API. I would like to know where a hibernate session is opened/closed in such a project.
Does spring open a session at the beginning of a @Transactional annotated method and close the session at the end of the method? If not, when exactly does hibernate session opening/closing happen?
Is there a way to keep the current session after a @Transactional method has returned? For example to lazy load collections outside a @Transactional method?
Please note that I am not necessarily talking about a web project. It can be any kind of project.