• 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
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

Mock Exam Question

 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Session bean class must implements javax.ejb.SessionBean? True or False?

2) Which cases can cause a session bean instance to be destroyed without the container calling ejbRemove()? Answer: The client invokes the remove method while the bean is in transaction (True or False?)
[ May 16, 2004: Message edited by: Alibabra Sanjie ]
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Answer (1): True, implementing javax.ejb.SessionBean gives you the 'beanie attributes' (SessionContext, container callbacks) and lets the Container kick in to provide its services like security, transactions etc.

Answer (2): i. EJB Container crash
ii. Bean times out while passivated state
iii. Bean throws system exception.

and I'm finding it kinda hard to understand what you try to mean in the third question. maybe some clarification would help me.

Also, can you please post where you get/got these questions from???

hope this helps-
 
Alibabra Sanjie
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Shahfazal Mohammed! And Sorry for the confusion of my second question. Please refer the edited question in my first post again for the correctness.

Regarding your answer (1). Because of the word "MUST" in the question, I can argue that it is not necessary to implementing javax.ejb.SessionBean directly, instead I can extends myClass which implementing javax.ejb.SessionBean. In this case, it is only indirect to implement javax.ejb.SessionBean. So it's incorrect. What do you think?
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The bean would still be a javax.ejb.SessionBean as it IS-A SessionBean.
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
2) Which cases can cause a session bean instance to be destroyed without the container calling ejbRemove()? Answer: The client invokes the remove method while the bean is in transaction (True or False?)
the answer is false. When remove()ia called EJBRemove() will be called
 
Alibabra Sanjie
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

2) Which cases can cause a session bean instance to be destroyed without the container calling ejbRemove()? Answer: The client invokes the remove method while the bean is in transaction (True or False?)

the answer is false. When remove()ia called EJBRemove() will be called



The client invoking the remove method while the bean is in transaction will result in Runtime Exception. When the bean receive runtime exception, the bean will be destroyed by the container without calling ejbRemove(). What do you think?
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, the client of a stateful session bean cannot remove a session object whilst the bean is in a transaction. Any attempt to do this will cause the container to throw javax.ejb.RemoveException to the client.
 
Won't you be my neighbor? - Fred Rogers. tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic