Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mock Exam Question

 
Alibabra Sanjie
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 ]
 
Shahfazal Mohammed
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?
 
Roger Chung-Wee
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.
 
Girija Siva
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic