1 Reply Latest reply on Feb 19, 2007 8:02 AM by Lawrie Gallardo

    Booking example question

    Lawrie Gallardo Newbie


      I've just been re-reading the Seam tutorial and I just wanted to check if my understanding is correct regarding the Booking example code...

      In the HotelBookingAction class the selectHotel method reads as follows:

      public String selectHotel(Hotel selectedHotel) {
       hotel = em.merge(selectedHotel);
       return "hotel";

      Am I correct that the reason the line hotel = em.merge(selectedHotel) is necessary is because the selectedHotel object was obtained by a different entity manager?

      And, if so, does this mean that you always need to use em.merge when an object that was loaded in one class is passed as a parameter to a method in another class?