Win a copy of Terraform in Action this week in the Cloud 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

SoftSCBCD mock question ?

 
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Q27. A stateful session bean ProcessOrder with container-managed transaction demarcation accesses another session bean ConfirmOrder. In which of the following methods ProcessOrder bean can access ConfirmOrder bean (select two):
A.setSessionContext
B.business methods from component interface
C.methods from javax.ejb.SessionBean interface
D.methods from javax.ejb.SessionSynchronization interface
softSCBCD give the answer: B. C . But I think only B is correct. Am I right?
---------
Entity beans
in the Home , create has to name transaction, therefore, ejbCreate()/ ejbPostcreate() in the Bean class has SAME transaction. This is correct?
if correct, then how about remove, we have different remove() in the Object and Home, so ejbRemove() should follow which transaction?
-----------
Thanks.
Edward
 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For stateful session beans, the ejbCreate and ejbRemove methods can call methods on other beans. However, you cannot call setRollbackOnly or getRollbackOnly of the SessionContext in these methods.
For stateless session beans, you cannot call methods from other beans in the ejbCreate and ejbRemove methods.
 
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Edward

Originally posted by Edward Chen:
Q27. A stateful session bean ProcessOrder with container-managed transaction demarcation accesses another session bean ConfirmOrder. In which of the following methods ProcessOrder bean can access ConfirmOrder bean (select two):
A.setSessionContext
B.business methods from component interface
C.methods from javax.ejb.SessionBean interface
D.methods from javax.ejb.SessionSynchronization interface
softSCBCD give the answer: B. C . But I think only B is correct. Am I right?


I think you may be right. setSessionContext method is from javax.ejb.SessionBean and bean access is not allowed from this method.

Originally posted by Edward Chen:

---------
Entity beans
in the Home , create has to name transaction, therefore, ejbCreate()/ ejbPostcreate() in the Bean class has SAME transaction. This is correct?


That is correct. Page 172 of the spec says
An ejbPostCreate<METHOD>(...) method executes in the same transaction context as the previous ejbCreate<METHOD>(...) method.

Originally posted by Edward Chen:

if correct, then how about remove, we have different remove() in the Object and Home, so ejbRemove() should follow which transaction?


ejbRemove() runs in the same transaction context as the remove() method that initiated it.
Page 173 of the spec says:
This method and the database delete operation(s) execute in the transaction context determined by the transaction attribute of the remove method that triggered the ejbRemove method.
Hope this helps
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic