Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Why does UserTransaction appear in 2 categories?

 
Ranch Hand
Posts: 156
  • 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.
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • 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
  • 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
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • 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
  • 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
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • 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
 
Greenhorn
Posts: 22
  • 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?
 
Ranch Hand
Posts: 219
  • 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.
    Bookmark Topic Watch Topic
  • New Topic