Quantcast

spring events plugin - Error in listener - could not initialize proxy - no Session

classic Classic list List threaded Threaded
1 message Options
SN
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

spring events plugin - Error in listener - could not initialize proxy - no Session

SN

I am using Spring events plugin, and the events are generated from gorm events afterInsert and afterDelete

class Book {

afterInsert = {
   
  publishEvent(new InsertEvent(this))
}


afterDelete = {
  publishEvent(new DeletetEvent(this)) 
}
}
 
Now code inside Insert/Delete listener is such that it can create/delete new books that will fire the events again for newly created/deleted books.

- Every thing works fine for insert
- Every thing goes fine for the delete event - when the book delete is not triggered from the listener
- The issues comes up when some of the books is deleted from the listener, it will fire the event again and hence the listener will be called, but at this time listener will not be able to access the event source, trying to do so throws 
org.hibernate.LazyInitializationException: could not initialize proxy - no Session

I am not sure why the session is not available to listener when a book is deleted from the listener - even though execution goes to the same route Book,delete -> afterDelete -> publishEvent - > Listener called


Any help would be appreciated.
 
Thanks  
Sudhir 
 
Loading...