I have a scenario where multiple service methods are used to display a page.
ie:
Code:
request.setAttribute(ConstantsIF.DENTAL_FOCUS_LANDING_CONTENT,newsForYouService.findNewsForYouLandingPageLatestContent(applicationUser,ConstantsIF.NEWS_CATEGORY_DENTAL_FOCUS));
request.setAttribute(ConstantsIF.QUALITY_NEWS_LANDING_CONTENT,newsForYouService.findNewsForYouLandingPageLatestContent(applicationUser,ConstantsIF.NEWS_CATEGORY_QUALITY_NEWS));
request.setAttribute(ConstantsIF.INDUSTRY_NEWS_CONTENT,newsForYouService.findNewsForYouLandingPageLatestContent(applicationUser,ConstantsIF.NEWS_INDUSTRY_NEWS));
The data comes from the same table but data and associated collections etc are filtered differently depending on the service method called.
The problem I'm experiencing is that I want the jsp page that is displayed to do the navigation through the object graph and lazy load as necessary. As such I apply the OpenSessionInView pattern. But only the filters that were enabled in each method should be applied.
So for instance if i'm navigating through ConstantsIF.DENTAL_FOCUS_LANDING_CONTENT then I need only the filters enabled in that method to be applied and not the filters enabled in the other 2 methods. I need the enabled filters to be tied to the object returned rather than the session or some mechanism to bound the view tier naviagation be instructions associating it with a set of enabled filters.
Since the session remains open through the multiple calls the enabled filters are conflicting. Is that possible to avoid this. If not are there any workarounds OTHER THAN making each service call isolated per session and initializing all the required data per method before returning to view tier.