• 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
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Lazy Initialization Exception while trying to remove an object

 
Ranch Hand
Posts: 153
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hallo,
I have a JSE application which uses JPA with Hibernate



I have a OneToMany Bidirectional relationship with lazy fetching:


When I try to remove a Grundentscheidung I get a org.hibernate.LazyInitializationException.

So in the method remove I try to force loading the dependent Einzelentscheidung before I call em.remove:



Still I get a


I don't understand why there is no session....
I have created a Tx and startet it, so there should be a session.

Thanks for any input,

Hans
 
Markus Schmider
Ranch Hand
Posts: 153
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have found the problem, it came from the (generated) toString() method.
Sorry...

And the lines

are superfluous
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic