File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes  EJB rookie questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark " EJB rookie questions" Watch " EJB rookie questions" New topic

EJB rookie questions

Artemesia Lakener
Ranch Hand

Joined: Jun 21, 2005
Posts: 162
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

Joined: Jan 25, 2002
Posts: 775
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.

Reid - SCJP2 (April 2002)
I agree. Here's the link:
subject: EJB rookie questions
It's not a secret anymore!