What is the default hibernate session management behavior in spring?

I have a three layer application using spring and hibernate (controller โ†’ service โ†’ dao) and the transaction is applied to the service level. I am not setting up an OpenSessionInViewInterceptor or OpenSessionInViewFilter, and I want to know the sleep session management behavior. Open session per transaction or per request? Thanks!

+6
java spring hibernate session
source share
1 answer

If you use the HibernateTransactionManager , the Session will be bound to the current thread and will blush and close when the transaction ends either by commit or rollback.

see also

+5
source share

All Articles