Answer(s)
- stateful session bean contains a number of instance variables. The types of instance variablesA and B are NOT serializable. Instance variable B is a complex type which is populated by manybusiness calls, and can, therefore, NOT be refilled by the client without starting all over. A helperinstance variable C is defined as having a Serializable type, and can hold all the informationwhich is in variable B. For example, B is of type XML-DOM Tree and C of type String. Which twosolutions, when combined, maintain the state of the session bean over a passivation andactivation by the container? (Choose two.)A. The value of helper variable C is used to create the value of instance variable B in the beansno-arg constructor.
- The value of helper variable C is used to create the value of instance variable B in a@PostCreate annotated method.
- The value of helper variable C is used to create the value of instance variable B in a@PostActivate annotated method.
- Instance variable A must be made null and instance variable B must be converted to aSerializable type and assigned to another instance variable in a @PreDestroy annotatedmethod.
- Instance variable A must be defined transient. Instance variable B must be converted to aSerializable type, set to null, and assigned to the instance variable C in a @PrePassivateannotated method.
Correct Answer
The value of helper variable C is used to create the value of instance variable B in a@PostActivate annotated method.
Instance variable A must be defined transient. Instance variable B must be converted to aSerializable type, set to null, and assigned to the instance variable C in a @PrePassivateannotated method.