Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring 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:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Mock Exam Question

 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
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