Yes, with: @Observes(during = TransactionPhase.AFTER_SUCCESS)

The relevant methods in the booking example (with my added logging) are:
    public void confirm() {"confirm begin");
        em.persist(booking);;"confirm end");

    public void onBookingComplete(@Observes(during = TransactionPhase.AFTER_SUCCESS) @Confirmed final Booking booking) {"onBookingComplete begin");
        log.bookingConfirmed(booking.getHotel().getName(), booking.getUser().getName()); DefaultBundleKey("booking_confirmed")).defaults("You're booked to stay at the {0} {1}.")
                .params(booking.getHotel().getName(), new PrettyTime(locale).format(booking.getCheckinDate()));"onBookingComplete end");


On 05/01/12 17:32, Jason Porter wrote:
These are events you're observing?

On Wed, Jan 4, 2012 at 23:27, Dave Oxley <> wrote:

I've been attempting to add persistence to the seam-cron module for
which I need to use transaction events. Unfortunately I cannot get them
to work. They always get called immediately rather than when the
transaction is completed. So I turned to the seam-booking example
( which I saw was
using transaction events and added some logging (attached), but this
appears to have the same issue. The output from the log is:

17:13:16,580 INFO
(http-- confirm begin
17:13:16,587 INFO
(http-- Adding new booking to user's cached booking history
17:13:16,588 INFO
(http-- onBookingComplete begin
17:13:16,589 INFO
(http-- New booking at the W New York - Union Square
confirmed for Shane Bryzak.
17:13:16,599 INFO
(http-- onBookingComplete end
17:13:16,600 INFO
(http-- confirm end

But in theory the order of the logging should be:
confirm begin
confirm end
onBookingComplete begin
onBookingComplete end

I did note that there was nothing specifying a transaction was required
for the entirety of the confirm method so I also added
@TransactionAttribute(TransactionAttributeType.REQUIRED) to the method
(also in attached patch), but that had the same result.

I've been trying this in jboss-as-web-7.0.2.Final. I'm probably doing
something wrong but I don't know what. Does anyone have any ideas?


seam-dev mailing list

Jason Porter

Software Engineer
Open Source Advocate
Author of Seam Catch - Next Generation Java Exception Handling

PGP key id: 926CCFF5
PGP key available at:,