Hi,
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
(
https://github.com/seam/examples/tree/master/booking) 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
[org.jboss.seam.examples.booking.booking.BookingAgent]
(http--127.0.0.1-8080-1) confirm begin
17:13:16,587 INFO
[org.jboss.seam.examples.booking.booking.BookingHistory]
(http--127.0.0.1-8080-1) Adding new booking to user's cached booking history
17:13:16,588 INFO
[org.jboss.seam.examples.booking.booking.BookingAgent]
(http--127.0.0.1-8080-1) onBookingComplete begin
17:13:16,589 INFO
[org.jboss.seam.examples.booking.booking.BookingAgent]
(http--127.0.0.1-8080-1) New booking at the W New York - Union Square
confirmed for Shane Bryzak.
17:13:16,599 INFO
[org.jboss.seam.examples.booking.booking.BookingAgent]
(http--127.0.0.1-8080-1) onBookingComplete end
17:13:16,600 INFO
[org.jboss.seam.examples.booking.booking.BookingAgent]
(http--127.0.0.1-8080-1) 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?
Cheers,
Dave.