Results 1 to 3 of 3

Thread: JstlView+OpenSessionInViewFilter=LazyInitializatio nException

  1. #1
    Join Date
    Jan 2005
    Posts
    3

    Default JstlView+OpenSessionInViewFilter=LazyInitializatio nException

    OK so I'm trying to use the JstlView resolver from SpringMVC with a bunch of hibernate DAOs. Thinking that the OpenSessionInViewFilter will save me from the horror of LazyInitializationExceptions, I create these DAOs with lazy collections in them.

    I pass the jsp page, the personService from which I get a personList. (This involves doing a session.find with the session being got from SessionFactoryUtils.getSession(sessionFactory,fals e).)

    I then iterate across the list and the children. However, as soon as I try to use iterate across a collection which is lazyinitialized I get a LazyInitializationException - no session or session closed.

    Unh? How do I fix this?

    Thanks

  2. #2
    Join Date
    Jan 2005
    Posts
    3

    Default

    OK it turns out that the SessionFactory the OpenSessionInViewFilter is getting is different to the one that my DAOService is getting. How I don't know, since there is only one defintion of mySessionFactory and it is used by both.

    Any ideas why this is happening?

  3. #3
    Join Date
    Jan 2005
    Posts
    3

    Default

    Right having read the similar Struts problem I decided to take a look at my servlet loading order. Changing these so that the ContextLoaderServlet loads first, and ensuring that the DispatcherServlet loads after that removes this problem. Could the reference doc be changed to take account of this problem please as this has just wasted an entire day. Thanks.

Similar Threads

  1. JstlView and LocalizationContext problem
    By jackysee in forum Web
    Replies: 9
    Last Post: Jun 17th, 2011, 12:10 PM
  2. Replies: 7
    Last Post: Feb 8th, 2007, 05:50 AM
  3. Replies: 3
    Last Post: Nov 23rd, 2005, 04:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •