Win a copy of AWS Security this week in the Cloud/Virtualization 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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.
 
Good heavens! What have you done! Here, try to fix it with this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic