1 Reply Latest reply on Mar 13, 2008 1:21 PM by Shane Bryzak

    WebRemoting and Context

    Brom bie Newbie

      Hi all,


      Does anyone know how to avoid LazyInitializationException when sending Entities back through Seam Web Remoting?


      In my use case, I have a SLSB with WebRemote-able methods and a typical object graph.  Like this:



      @Local
      public interface HouseAction {
          @WebRemote public House geHouse(long houseId)
      }


      The house entity object itself has one-to-many with Room objects.  All getters in House and Room object are WebRemote-able


      This method below returns a LazyInitializationException when called from Web Remoting since the Rooms haven't been initialized yet and there wasn't any sessions to do it:



      public House getHouse(long houseId) {
          House house= em.find(House.class, houseId);
          return House
      }


      What would be the proper way to avoid this?   Is a conversation scope required to accomplish this?  If yes, where should it begin and end?  


      Thanks for all your help!


      thanks!