Meaningless Drivel is fun!*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes lifecycle callback method question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "lifecycle callback method question" Watch "lifecycle callback method question" New topic
Author

lifecycle callback method question

leonardo segala
Greenhorn

Joined: Sep 02, 2009
Posts: 26
Hi Ranchers!

I have WLC question which probably wrong, but I will post to discuss:

Which statement characterizes stateless session beans?

A - They allow the PostConstruct, PreDestroy, and PrePassivate life-cycle callbacks.
B - They require home interfaces.
C - When a client looks up a stateful session bean in the JNDI, the same bean is returned every time.
D - They are asynchronous message consumers.

The correct answer by WLC is A, but PrePassivate callback is only available for stateful beans. I marked D, because MDB is a special stateless bean which supports asynchronous messages. What yours opinions?
Deepika Joshi
Ranch Hand

Joined: Feb 24, 2009
Posts: 268
Which statement characterizes stateless session beans?
or which statement is true for Stateless Session Bean


B - They require home interfaces.
No
C - When a client looks up a stateful session bean in the JNDI, the same bean is returned every time
No (beans comes from pool, so not always same)
D - They are asynchronous message consumers.
No, because MDB is a special stateless bean which supports asynchronous messages.
A - They allow the PostConstruct, PreDestroy, and PrePassivate life-cycle callbacks.
here is tricky part, PrePassivate does not make sense for Stateless Session bean, if you have it in your bean, it won't be called but won't complain also about abuse use (not following the contract (rule) mentioned in spec).

Prasad Kumbhare
Greenhorn

Joined: Oct 18, 2007
Posts: 26

But quesiton says, Which statement characterizes stateless session beans? If we talk about having @PrePassivate in SLSB then question should have been , what callbacks are valid / allowed/ don't generate error in SLSB, or something like that. Makes sense ??
I think this could be problem in question.


Thanks,
Prasad Kumbhare
SCJP 5.0, SCWCD 5.0, SCBCD 5.0
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: lifecycle callback method question