• 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

HFEJB - Q 11 page 370

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which method from EntityContext interface must NOT be invoked from within the EJBLoad method?
answer is : getUserTransaction() for BMT only.
The answer also refers to page 180 of ejb spec, but I couldn't find that anywhere. Will anyone help me out verify the answer. Secondly, I would like to know from what methods getUserTransaction could be called. EJBLoad always runs in a transaction context so it not being able to call getUserTransaction() doesn't seem logical to me.
thanks.
- walk rustin
 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is because entity beans are allowed to use only CMT transactions and in CMT transactions you cannot obtain reference to the usertransactions. In Pg 180 of the spec table 4 list all the methods which can be invoked from the methods of entity beans
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to Javaranch. I've just started preparing for SCBCD. I do not have much experience in EJB. But, what I understood from HF book is that, ejbLoad and ejbStore are called by the container when you use CMT. But, getUserTransaction can only be used with BMT, because the bean provider has to deal with the transaction. If you invoke getUserTransaction from ejbLoad, you are trying to use userTransaction for CMT, which doesn't make sense. I am not sure if this is the correct answer to your question, but this is what I understood goign through the HF book.
 
I have always wanted to have a neighbor just like you - Fred Rogers. Tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic