I am using JPA with spring transactions. I have observed same session is alive till athread exits method1. I believe its happening becoz of
@Transactional
As per my understanding magic must be happening under the hood becoz of this
As soon as thread enters method1 , if any operation retrieves entityManager(parallel to session in hibernate) . spring proxy binds that entityManager/session(which internally binds to database connection object) with that thread so that down the line if any other operations asks for entityManager/session, spring will provide same entityManager/session. Is that correct?
@Transactional
method1(){}