Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB rookie questions

 
Artemesia Lakener
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please help me, an EJB rookie, clarify the following confusions --

1. can I use transaction if I ONLY have stateless session bean ? please give me a simple example when this is appropriate.

2. can I use transaction if I ONLY use stateful session bean ?

3. is it true that if I use application server to handle transaction, I should NOT use JTA any more. And all I need to do is to set the transaction attributes in the xml file ? what else do I need to do for transaction ?
 
Reid M. Pinchback
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Every type of EJB component: session bean (both SLSB and SFSB), entity bean (BMP and CMP) and message-driven-bean can have a transaction. They are mandatory for entity beans, optional for all the others.

You are correct. If you are using container-managed transactions then you don't write any JTA code. Everything is in the DD.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic