• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Lazy Initialization Exception while trying to remove an object

 
Markus Schmider
Ranch Hand
Posts: 132
1
  • Mark post as helpful
  • send pies
  • 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: 132
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have found the problem, it came from the (generated) toString() method.
Sorry...

And the lines

are superfluous
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic