title: What does adding the @Stateful or @Stateless annotations actually do?
body: <p>I'm just getting to grips with Java EE. I know that adding <code>@Stateful</code> or <code>@Stateless</code> annotations to a class will make it an EJB bean. But what is actually happening in the background once I do that? I see the following listed on Wikipedia in relation to EJBs.</p>
  
  <ul>
  <li>Transaction processing</li>
  <li>Integration with the persistence services offered by the Java
  Persistence API (JPA)</li>
  <li>Concurrency control</li>
  <li>Eventing using Java Message Service and Java EE Connector
  Architecture</li>
  <li>Asynchronous method invocation</li>
  </ul>
  
  <p>&nbsp;</p>
  
  <ol>
  <li>When I mark a class as an EJB do items listed above get 'taken care
  of' in the background? An entirely different code path is followed
  that goes through each of the above once I make a class an EJB, is
  that what's happening?</li>
  <li>I see that using CDI I have the option of injecting EJB beans as oppposed to CDI beans. In that case should I always be using EJB beans instead of CDI beans as EJB beans are more powerful than CDI beans?</li>
  </ol>