In order to understand what happens in a request flow, I captured the below log
Code:
15 Sep 2009 21:01:35,310 DEBUG AbstractUrlHandlerMapping - Looking up handler for [/test.do]
15 Sep 2009 21:01:35,310 DEBUG DispatcherServlet - Testing handler adapter [org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter@8ad367]
15 Sep 2009 21:01:35,310 DEBUG DispatcherServlet - Testing handler adapter [org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter@3d3258]
15 Sep 2009 21:01:35,310 DEBUG DispatcherServlet - Last-Modified value for [/hptestsite/test.do] is: -1
15 Sep 2009 21:01:35,310 DEBUG DispatcherServlet - DispatcherServlet with name 'spring' received request for [/hptestsite/test.do]
15 Sep 2009 21:01:35,310 DEBUG DispatcherServlet - Bound request context to thread: org.acegisecurity.wrapper.SavedRequestAwareWrapper@1b46c0d
15 Sep 2009 21:01:35,310 DEBUG OpenSessionInViewInterceptor - Opening single Hibernate Session in OpenSessionInViewInterceptor
15 Sep 2009 21:01:35,340 DEBUG DispatcherServlet - Testing handler adapter [org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter@8ad367]
15 Sep 2009 21:01:35,340 DEBUG DispatcherServlet - Testing handler adapter [org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter@3d3258]
15 Sep 2009 21:01:35,340 ERROR TestController - Executing testManager method
15 Sep 2009 21:01:35,340 DEBUG HibernateTransactionManager - Found thread-bound Session [org.hibernate.impl.SessionImpl@d95b06] for Hibernate transaction
15 Sep 2009 21:01:35,350 DEBUG AbstractPlatformTransactionManager - Using transaction object [org.springframework.orm.hibernate3.HibernateTransactionManager$HibernateTransactionObject@1e6e860]
15 Sep 2009 21:01:35,350 DEBUG TransactionAspectSupport - Getting transaction for [com.jnj.hp2.hptestsite.service.TestManager.test]
15 Sep 2009 21:01:36,502 DEBUG TransactionAspectSupport - Completing transaction for [com.jnj.hp2.hptestsite.service.TestManager.test]
15 Sep 2009 21:01:36,502 DEBUG AbstractPlatformTransactionManager - Triggering beforeCommit synchronization
15 Sep 2009 21:01:36,502 DEBUG AbstractPlatformTransactionManager - Triggering beforeCompletion synchronization
15 Sep 2009 21:01:36,502 DEBUG AbstractPlatformTransactionManager - Triggering afterCommit synchronization
15 Sep 2009 21:01:36,512 DEBUG AbstractPlatformTransactionManager - Triggering afterCompletion synchronization
15 Sep 2009 21:01:36,512 ERROR TestController - waiting....
15 Sep 2009 21:01:36,822 ERROR TestController - setting pageAttributes------------------------------
15 Sep 2009 21:01:37,143 ERROR TestController - item.getKeywords() = 5
15 Sep 2009 21:01:37,143 ERROR TestController - missie,innovatie,kwalitatieve farmaceutische producten,diensten,patiënten
15 Sep 2009 21:01:37,143 ERROR TestController - setting pageAttributes completed-------------------
15 Sep 2009 21:01:37,143 ERROR TestController - Leaving handleRequestInternal
15 Sep 2009 21:01:37,153 DEBUG OpenSessionInViewInterceptor - Flushing single Hibernate Session in OpenSessionInViewInterceptor
15 Sep 2009 21:01:37,153 DEBUG AbstractCachingViewResolver - Cached view [test]
15 Sep 2009 21:01:37,153 DEBUG DispatcherServlet - Rendering view [org.springframework.web.servlet.view.JstlView: name 'test'; URL [/pages/test.jsp]] in DispatcherServlet with name 'spring'
15 Sep 2009 21:01:37,153 DEBUG AbstractView - Rendering view with name 'test' with model {item=bf19514831e99d5bf10c12b5eea91bef - /backgrounders/janssen-cilag.be_dut/pool_content/about_mission.xml - about_mission} and static attributes {}
15 Sep 2009 21:01:37,163 DEBUG AbstractView - Added model object 'item' of type [com.jnj.hp2.ehealth.cms.model.Backgrounder] to request in view with name 'test'
15 Sep 2009 21:01:37,163 DEBUG AbstractView - Added model object 'rc' of type [org.springframework.web.servlet.support.RequestContext] to request in view with name 'test'
15 Sep 2009 21:01:37,163 DEBUG InternalResourceView - Forwarding to resource [/pages/test.jsp] in InternalResourceView 'test'
15 Sep 2009 21:01:38,415 DEBUG OpenSessionInViewInterceptor - Closing single Hibernate Session in OpenSessionInViewInterceptor
15 Sep 2009 21:01:38,415 DEBUG DispatcherServlet - Cleared thread-bound request context: org.acegisecurity.wrapper.SavedRequestAwareWrapper@1b46c0d
15 Sep 2009 21:01:38,415 DEBUG FrameworkServlet - Successfully completed request
The session life cycle begins and ends at OSIVI. I am still not sure what is flow (from a session perspective) when we access data that is lazily loaded.
In the above log,
15 Sep 2009 21:01:37,143 ERROR TestController - item.getKeywords() = 5
15 Sep 2009 21:01:37,143 ERROR TestController - missie,innovatie,kwalitatieve farmaceutische producten,diensten,patiënten
the item.getKeywords() is lazily loaded, i don't see any logger statements that indicates which session is getting used, can you throw some light on what happens (I mean session life cycle) when we try to access lazy data?