File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Why does UserTransaction appear in 2 categories? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Why does UserTransaction appear in 2 categories? " Watch "Why does UserTransaction appear in 2 categories? " New topic
Author

Why does UserTransaction appear in 2 categories?

Timothy Toe
Ranch Hand

Joined: Oct 19, 2002
Posts: 156
I am trying to understand Valentin Crettaz�s Bean LC Cheat Sheet.

I wonder why does UserTransaction appear in 2 categories :

Tx: access to getUserTransaction()
and
Res: access to UserTransaction ...

Thanks.
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
Because when programming beans with bean-managed transaction demarcation you have two ways of getting hold of a UserTransaction object:
1. By calling getUserTransaction() on the context object.
2. By looking up in JNDI the UserTransaction object mapped to the java:comp/UserTransaction


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Timothy Toe
Ranch Hand

Joined: Oct 19, 2002
Posts: 156
Oh I see.

I was not aware of the 2nd way of getting the UserTransaction object.

This makes me wonder why must there be 2 ways... kind of redundant.

Is this address (java:comp/UserTransaction) in the JNDI fixed ?

Thanks Crettaz.
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
This makes me wonder why must there be 2 ways... kind of redundant.
Well, yeah, but you know...

Is this address (java:comp/UserTransaction) in the JNDI fixed ?
Yes, it is a requirement of the EJB 2.0 specification.
Timothy Toe
Ranch Hand

Joined: Oct 19, 2002
Posts: 156
Crettaz, Thanks for the reply !!!

If I am a girl, I'll give you a kiss... but unfortunately... I am not.
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
If I am a girl, I'll give you a kiss... but unfortunately... I am not.
And *unfortunately*, I would not be available anyway
Arun Krishnamoorthy
Greenhorn

Joined: Nov 03, 2004
Posts: 22
Just to clarify, wouldn't the JNDI context be available under java:comp/env/UserTransaction instead of java:comp/UserTransaction?
Thiru Thangavelu
Ranch Hand

Joined: Aug 29, 2001
Posts: 219
I think java:comp/UserTransaction is correct.


Thanks,<br />Thiru<br />[SCJP,SCWCD,SCBCD]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why does UserTransaction appear in 2 categories?