title: Suitable way to interact with Hibernate sessions in multi-thread environment
body: <p>Context of Multi-Thread environment like web app, whenever required to use sessions using Hibernate what would be the best way to get session either getcurrentsession() or opensession() ?</p>
  
  <p>As on here <a href="https://java2blog.com/difference-opensession-getcurrentsession-hibernate/" rel="nofollow noreferrer">opensession vs getcurrentsession</a> it has mentioned that getcurrentsession is not to be use in web applications.</p>
  
  <p>While session is not tread-safe, due to that reason isn't it suits for use getcurrentsession ? Is it need to use opensesion and commit &amp; close flush manually ?</p>
  
  <p>I need a clear clarification. Thanks All.</p>
  
  <p>PS : I used hibernate with Spring Boot App for testing purpose.</p>