[jboss-user] [JBoss Seam] - Re: booking example and db2

tazo do-not-reply at jboss.com
Mon Jul 24 15:03:51 EDT 2006


Got same problem with MSSQL and Derby on Glassfish. 

Booking conformation action handler (HotelBookingAction.confirm method)  invokes BookingListAction.getBookings method to update bookings list used in main page after inserting new booking to DB:


  | // HotelBookingAction.java
  |  @End
  |    public String confirm()
  |    {
  |       if (booking==null || hotel==null) return "main";
  |       em.persist(booking);
  |       facesMessages.add("Thank you, #{user.name}, your confimation number for #{hotel.name} is #{booking.id}");
  |       log.info("New booking: #{booking.id} for #{user.username}");
  |       events.raiseEvent("bookingConfirmed");
  |       return "confirmed";
  |    }
  | 
  | // BookingListAction.java
  | @SuppressWarnings("unchecked")
  |     @Factory
  |     @Observer("bookingConfirmed")
  |     public void getBookings() {
  |         bookings = em
  |                 .createQuery(
  |                         "from Booking b where b.user.username = :username order by b.checkinDate")
  |                 .setParameter("username", user.getUsername()).getResultList();
  |     }
  | 
  | 
  | 

BookingListAction is annotated with @TransactionAttribute(REQUIRES_NEW).  That's why deadlock.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960499#3960499

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960499



More information about the jboss-user mailing list