-->
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: Open session in view and struts
PostPosted: Wed Jan 24, 2007 4:43 pm 
Newbie

Joined: Wed Jan 17, 2007 9:17 am
Posts: 3
I have an application which uses struts and hibernate. I'm badly using the Open Session in View pattern the way is writting in http://hibernate.org/43.html. The application is finished and I realize too late that the view is rendering before the commit and if an exeption is thrown the user see a successful page. This occurs unusually that is why I didn't realize before.

One suggestion is to commit in the data-management layer. Be couse I'd have to change a lot of code.

The other suggestion is to open two sessions, one in the filter and the other in the extended RequestProcessor.processActionPerform() method. Open a try-catch block, call ActionForward = super.processActionPerform() and close the session when going out the block. But what's about when rendering the view and it hits an unloaded collection or a proxy that isn't initialized.

Does the second suggestion solve the problem? Could any body who has implemented it write the code here?

Thanks a lot.


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.