File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why does UserTransaction appear in 2 categories?

 
Timothy Toe
Ranch Hand
Posts: 156
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7610
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Timothy Toe
Ranch Hand
Posts: 156
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7610
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 156
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7610
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to clarify, wouldn't the JNDI context be available under java:comp/env/UserTransaction instead of java:comp/UserTransaction?
 
Thiru Thangavelu
Ranch Hand
Posts: 219
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think java:comp/UserTransaction is correct.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic