EJB-like transactions in JAX-RS

I am adding a RESTful API to an existing application (JBoss 4, EJB 2, adding RESTEasy). The application currently has a beans session with container-managed transactions. To get started, I invoke remote interfaces on Enterprise Beans. The use of EJB is phasing out, so new features will be added without writing new methods in Beans.

Does JAX-RS or JBoss 4 support transactional support in resource methods? Or do I need to write my own transaction code in each of the resource methods?

JAX-RS has PreProcessInterceptors and PostProcessInterceptors, but doesn't seem to have an interceptor that terminates the call.

+3
source share
3 answers

, REST- "" , JAX RS

0

JAX-RS bean, - param, , .

, @Injected (CDI) UserTransaction JAX-RS bean () :

userTransaction.begin(); 
// code requiring transaction goes here 
userTransaction.commit(); 

, , .

0

Source: https://habr.com/ru/post/1768477/


All Articles