These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Mult service calls w Hibernate Filters & OpenSessionInVi
PostPosted: Mon Jan 16, 2006 2:20 pm 
Regular
Regular

Joined: Thu Sep 09, 2004 6:46 pm
Posts: 96
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.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 16, 2006 8:22 pm 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
I do not know the answer to your first question, but I would assume that filter is not the right choice here.

A try to answer to your second question.
Why can't you just write a query like
Code:
select n from News n left join fetch n.details
where n.category = :CategoryType
request.setAttribute(x, query.setInteger(Constant).list());


Regards Sebastian

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.