• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

More Mock Questions Here

 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A few more...
Here's my attempt at a *matching* drag-and-drop question. These are off the top of my head again, so I can't guarantee they're perfect
============================
QUESTION ONE:
Match the operation in list ONE with the method in list TWO in which that operation can be performed, for a stateful session bean:
LIST ONE: Operations (things you want to do)
1) invoke the SessionContext.setRollbackOnly()
2) invoke the UserTransaction.setRollbackOnly()
3) access this bean's own EJBObject interface
4) access this bean's own home interface
5) access a reference to another EJB

LIST TWO: Bean methods in which the operations from list one can be performed:
A) ejbCreate
B) afterBegin
C) business method
D) setSessionContext
E) afterCompletion
Note: There *may* be more than one correct answer!
===========================

QUESTION TWO:
In what order will the following events in a stateful session bean's lifecycle occur? Assume the client already has a reference to a bean's home object, and needs to invoke a business method on a bean.
(place a number next to each one)
A) Client invokes a business method
B) ejbCreate invoked on the bean
C) transaction committed
D) afterCompletion is called
E) afterBegin is called
F) beforeCompletion is called
G) business method invoked on the bean
H) setSessionContext invoked on the bean
I) bean constructor invoked
J) client invokes create on the home
=========================
cheers,
Kathy
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For Q2, I would place it as follows:
1. J) client invokes create on the home
2. I) bean constructor invoked
3. H) setSessionContext invoked on the bean
4. B) ejbCreate invoked on the bean
5. A) Client invokes a business method
6. E) afterBegin is called
7. G) business method invoked on the bean
8. F) beforeCompletion is called
9. C) transaction committed
10.D) afterCompletion is called
My only doubt for this question (kewl one ) was the afterBegin() method. Well, the spec is out there for it, and yes, it is actually called before any business method invoked on the bean.
Will dig for Q1 info, this one requires deep knowledge of the internals. Required for the exam, good (but not strictly required) in real-life.
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Kathy Sierra:
QUESTION ONE:
Match the operation in list ONE with the method in list TWO in which that operation can be performed, for a stateful session bean:
LIST ONE: Operations (things you want to do)
1) invoke the SessionContext.setRollbackOnly()
2) invoke the UserTransaction.setRollbackOnly()
3) access this bean's own EJBObject interface
4) access this bean's own home interface
5) access a reference to another EJB

LIST TWO: Bean methods in which the operations from list one can be performed:
A) ejbCreate
B) afterBegin
C) business method
D) setSessionContext
E) afterCompletion
Note: There *may* be more than one correct answer!


Ok, i hope i won't mess up this time
1 - B,C (May be called only if there is a transaction context and CMT is used).
2 - A,C (B is not possible since BMT does not support SessionSynchronization interface)
3 - A,C or A,B,C,E depending on Transaction management BMT or CMT (according to the spec there is no SFSB identity at the time the method setSessionContext() is called)
4 - A,C,D or A,B,C,D,E also depending on transaction management BMT/CMT: You can always (Except in the bean constructor) access the EJBHome.

5 - A,C or A,B,C (BMT/CMT): In the afterCompletion() method there is no transactional context, setSessionContext() has no caller identity.
Dragan
 
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kathy ?
 
money grubbing section goes here:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic