• 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

lifecycle callback method question

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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).

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
reply
    Bookmark Topic Watch Topic
  • New Topic