java - Ejb, Error in second method rolls back first method -
i have poller scheduled this
@schedule(minute = "*/5", hour = "*", persistent = false) public void polltimer() { startfirstpoller(); startsecondpoller(); } @transactionattribute(transactionattributetype.requires_new) private void startfirstpoller() { // find booking database , update bokingfacade.findall(); bokingfacade.update(booking); } @transactionattribute(transactionattributetype.requires_new) private void startsecondpoller() { // find booking updated database , update bokingfacade.findall(); bokingfacade.update(booking); }
the first method update bookings, save them database , second method use updated information process further , again update database. problem changes doesn't reflect in database until , unless second executes successfully. moreover, exception in second method rollback successful changes made first method. please let me know happening , how make 2 method independent of each other.
i assume because don't define start , end of transaction managed container , spans entire execution.
you can manage transactions using annotations in java ee. jta api transactions.
Comments
Post a Comment