• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFEJB - Q 11 page 370

 
Walker Rustin
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
 
Sudhir V
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
 
Sany Bel
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic