-->
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.  [ 1 post ] 
Author Message
 Post subject: Session Management with MVC
PostPosted: Thu May 06, 2004 2:26 pm 
Newbie

Joined: Thu Apr 29, 2004 10:36 pm
Posts: 3
Wow!! I did not realize that managing sessions in MVC was going to be such a complicated issue. I have read the following:

http://www.hibernate.org/43.html -- Open Session in View Pattern

and also

http://www.hibernate.org/43.html -- Forum Discussion about this

So my question is this. I have a layered application where hibernate generated objects are my data layer. Then I have a layer of business objects, then of course my view (which happens to be a struts application).

I am in the process of converting my app to use hibernate, mainly due to performance issues, and I want to make sure that I implement it in a way that makes the most sense. I am struggling with the question of how to handle my sessions for the view and bus portions of the application.

Right now, in my bus logic for all of my transactions, inserts, deletes, selects, etc... I open a session do my stuff then close the session. This works all fine and dandy of course until I get to the presentation side of things and need to display an association of some sort. Like say a one to many.

I saw the Open Session in View pattern and I guess that will work to get the associated objects while rendering the view; however, it looks a little complicated. So my questions are:

1) Is there an easier way to do this (e.g. load objects during the view)?

2) Is there any way to say getAssociatedCollection() in the bus layer and just pass the object up to the view already initialized without having to open another session?

3) Is opening two sessions (one for the bus layer and one for getting the associated objects during the view) a bad design? If I use the Open Session in View Pattern, I will be essentially opening two sessions. One for the select down in the bus logic and one when presenting the view.

Mainly I am just looking for ideas and also to see if anyone else has solved this in an elegant way?
Thanks,
D


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

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.