hibernate - How to avoid LazyInitializationException when using WebSockets in Spring? -


any advices how avoid infamous lazyinitializationexception in following setup (working spring , hibernate) :

@messagemapping("/activate/foo") @sendtouser("/queue/result") public result doit(integer fooid) {     foo foo = fooservice.load(fooid); // via hibernate     result = ... // accessing foo outside hibernate transaction                  // therefore lazyinitializationexception thrown     return result; } 

what do?

  1. annotate doit() @transactional?
  2. calculate result inside method annotated @transactional?
  3. manually doing stuff opensessioninviewfilter doing servlet requests?
  4. utilizing type of "ready use" filters or interceptors websockets in spring (which one, how, examples?)
  5. tomcat websocket filter?

right i'm voting 3, looks uncool... ;-)


Comments

Popular posts from this blog

javascript - How to process users in one specific order using map o each function? -

java - Two interface have same method name with different return type -

javascript - Linking from page A to a specific iframe on page B -