• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

LazyInitializationException in Spring

 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.
Actually, I don't know if this question belongs to ORM forum or Application framework forum, but I will post it here, and our moderators can move it.
My application uses Struts, Spring and Hibernate and I mapped the relationships as lazy with batch fetch attribute.
I'm using Spring's support for Hibernate (HibernateDaoSupport) and you know, getHibernateTemplate and Spring's declerative transaction management.
Well, my Struts action gets the specified object using Hibernate and then set that object is request scope and forwards the request to a JSP page for displaying stuffs.
As you might have realised, I got LazyInitializationException because there is no opened Hibernate Session.
One solution to this problem is to fetch the collection eagrly but I want to fetch it lazly.
Is it possible to use HibernateUtil class (from CeaverEmptor application) with Spring's support class ?
Any ideas ?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic