I have poller scheduled like this
@Schedule(minute = "*/5", hour = "*", persistent = false)
public void pollTimer() {
startfirstPoller();
startsecondPoller();
}
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
private void startfirstPoller() {
// find all booking from database and update
bokingFacade.findAll();
bokingFacade.update(booking);
}
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
private void startsecondPoller() {
// find all booking updated from database and update
bokingFacade.findAll();
bokingFacade.update(booking);
}
The first method update some bookings, save them to database and second method use the updated information to process further and again update the database. The problem is changes doesn't reflect in the database until and unless second executes successfully. Moreover, exception in second method rollback the successful changes made by first method. Please let me know what is happening and how to make two method independent of each other.