• 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
  • Liutauras Vilda
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Peter Rooke
  • Himai Minh
Bartenders:
  • Piet Souris
  • Mikalai Zaikin

need explanation

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
These questions are from HFE

1.which are legal declarations for a CMP bean's ejbCreate methods

A.public void ejbCreateBigCustomer() throws javax.ejb.CreateException

B.public String ejbCreateAccount() throws javax.ejb.CreateException

C.static String ejbCreate() throws javax.ejb.CreateException

D.public int ejbCreate() throws javax.ejb.CreateException

E.public final String ejbCreate() throws javax.ejb.CreateException


I know A,C,E cannot be the answers.But why D cannot be the answer.For entity beans ejbcreate method returns a PrimaryKey.int can also act as a primarykey.


2.which method(s) from the EntityContext interface can be invoked from with in the ejbCreate method?

A.getEJBHome()
B.getEJBObject()
C.getCallerPrincipal()
D.getUserTransaction()
E.setRollBackOnly()

MyAnswers:A,C,E
Answers according to HFE:A,B,C,E

My doubt is how can B be the answer.Is it legal to call getEJBObject() from ejbCreate() of an entity bean.
container is not aware of the primarykey until the ejbCreate() returns.Then how can it prepare an EJBObject for the client,and how can we call getEJBObject();

3.which method(s) run in the transaction context of the method that causes their invocation?

A.ejbLoad()
B.ejbRemove()
c.ejbSelect()
D.ejbActivate()
E.ejbPassivate()
F.setEntityContext()

HFE Answers:A,B,C.

can any one please give the reason behind it.

thanks in advance
srinija
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi srinija,

1. because the primary key must be a *class*, so int is not OK but Integer is

2. you are right, it is not legal to call getEJBObject() from within ejbCreate()

3. the question should have been: which methods run in an unspecified transaction context? Answer D,E, and F. For the others the spec defines the transaction context in which they must run.
 
if you think brussel sprouts are yummy, you should try any other food. And this tiny ad:
Master Gardener Program
https://coderanch.com/t/771761/Master-Gardener-Program
reply
    Bookmark Topic Watch Topic
  • New Topic