arjacsoh
arjacsoh

Reputation: 9232

Declarative transaction management in EJB

I know that the questions which refer to a link are not the favorite ones to the users of this great site, but I could not set my question in a different way. I am trying to delve into EJB and CDI and how they are properly used in real Web-Applications. I have read this example developed on JBoss application server. Close to the end it creates the class ManagedBeanUserDao and then the alternative EJBUserDao in order to save itself from handling the transaction management manually. I cannot fathom though, how he actually achieves that, since there are no refernce to transactions neither in the beans.xml file nor in the alternative class EJBUserDao.

My genaral question is how we avoid in a typical way the transaction management and if there is a link that explains it in detail. I have looked at the JavaEE Tutorial, but in the example it does not seem to follow exactly what the Tutorial states.

Upvotes: 0

Views: 585

Answers (1)

JB Nizet
JB Nizet

Reputation: 691635

EJBs are transactional by default. Invoking any of their method automatically starts a transaction, which is committed after the method returns (or rolled back in case of a runtime exception).

Upvotes: 3

Related Questions