This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Which statements about stateful and stateless session beans are true?
A.Only stateful session beans support transactions.
B.Only stateful session beans can be passivated.
C.Only stateful session beans have a 'setSessionContext' method.
D.Both stateful and stateless session beans can support overloaded 'ejbCreate' methods.
E.Both stateful and stateless session beans can implement the 'javax.ejb.SessionSynchronization' interface.
F.Both stateful and stateless session beans can have instance variable state.
Correct answer B,F.
I think D is correct answer since even a stateless session bean can have overloaded ejbCreate() method, just thet the ones having arguments will nevcer be called.
Answer F is a bit tricky: it is true that both stateless and stateful SB can have instance variables. But what is the meaning of "instance variable state"? Since stateless session beans do not maintain state ...
The home interface of a stateless session bean must have one create method that takes no arguments. There can be no other create methods in the home interface. The session bean class must define a single ejbCreate method that takes no arguments.
But what is the meaning of "instance variable state"?
The instance variable that you can deifine in your stateless session bean can hold some values. That is what instance variable state means.