• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Why does UserTransaction appear in 2 categories?

 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think java:comp/UserTransaction is correct.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic