[ http://jira.andromda.org/browse/SPRING-69?page=comments#action_11523 ]
     
Sebastien Arbogast commented on SPRING-69:
------------------------------------------

Are you sure ?
Because I've just double checked in last edition and in chapter 8.1.1 this 
approach seems to be recommended through the use of the HibernateUtil class.

"The thread-local session pattern allows you to have a single Hibernate session 
per request, spanning the view and potentially multiple action executes(). Java 
provides
the ThreadLocal class for implementing thread scoped variables. The 
thread-local session pattern combines a ThreadLocal with an interceptor or 
servlet filter that closes the Session at the end of the request, after the 
view is rendered and just before the response is sent to the client."

By the way I've tried many different things and OpenSessionInViewFilter seems 
to be the most elegant solution.

> Adapting OpenSessionInViewFilter to AndroMDA
> --------------------------------------------
>
>          Key: SPRING-69
>          URL: http://jira.andromda.org/browse/SPRING-69
>      Project: Spring Cartridge
>         Type: New Feature
>  Environment: Web application on Tomcat servlet container
>     Reporter: Sebastien Arbogast
>     Assignee: Chad Brandon
>  Attachments: OpenSessionInViewFilterForAndromda.java
>
> To prevent the common "lazy loading" bug in the web tier, Spring framework 
> provides a utility servlet filter : OpenSessionInViewFilter. Unfortunately 
> this filter is not very flexible and it looks for the sessionFactory bean 
> directly in root application context whereas in the structure of Spring 
> configuration files generated by AndroMDA, it's one level down in 
> applicationContext.xml
> So with the default configuration of OpenSessionInViewFilter in web.xml, web 
> application initialization works fine but on the first filtered request, you 
> get an internal server error caused by a NoSuchBeanException on 
> sessionFactory.
> To solve this problem I propose to add a new class in Spring cartridge 
> generated files : OpenSessionInViewFilterForAndromda, which extends Spring 
> OpenSessionInViewFilter and overrides lookupSessionFactory for taking our 
> particular structure into account (see attachment).
> Then the only thing the user would have to do is to change the class for 
> OpenSessionInViewFilter filter in web.xml and everything should work fine.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.andromda.org/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Andromda-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/andromda-devel

Reply via email to