my dog learned polymorphism
The moose likes JSP and the fly likes using c:forEach with spring/hibernate lazy loading Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » JSP
Reply Bookmark "using c:forEach with spring/hibernate lazy loading" Watch "using c:forEach with spring/hibernate lazy loading" New topic
Author

using c:forEach with spring/hibernate lazy loading

Dave Brown
Ranch Hand

Joined: Mar 08, 2005
Posts: 301
Hi all,

Hoping someone can point out the error of my ways..

My very basic scenario is this..
1. Show login page
2. User(Agency) logs in
3. I set the Agency object in the session and forward to a menu page...
4. User clicks a link.
5. I show a jsp with a forEach tag which displays elements from a List collection belonging to the Agency object in the session.

at point 5 however I get a Hibernate LazyInitializationException (no session or closed session)

I have spring setup, with an openSessionInView filter.. which when I changed log4j to display Debug info showed me it is definately opening a session prior to processing the jsp page. Here is a snippet from server output..


as you can see the collection i'm trying to go over is sellers.. which belongs to my Agency object...

I've been scanning google and going over what I found for most the afternoon so any help pointers are greatly appreciated.

Thanks


Regards, Dave Brown
SCJP 6 - [url]http://www.dbws.net/[/url] - Check out Grails Forum
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56529
    
  14

That's a Hibernat issue, not a JSP one. Moved to the ORM forum.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: using c:forEach with spring/hibernate lazy loading
 
Similar Threads
using c:forEach with spring/hibernate lazy loading
LazyInitializationException
LazyInitializationException
LazyInitializationException in Spring
LazyInitializationException