Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

lifecycle callback method question

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
It's exactly the same and completely different as this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic