Java EE 7 Application Developer — Question 43
When should a JPA entity implement the Serializable interface?
Answer options
- A. when JPA entities are used in the EJB Full container
- B. when JPA entities are used outside of the EJB Lite container
- C. always, because JPA entities are required to implement the Serializable interface
- D. when JPA entities are used as parameters or return values by the remote EJB operations
Correct answer: D
Explanation
The correct answer is D because JPA entities need to be serializable when they are used as parameters or return values in remote EJB calls to ensure proper communication over the network. Options A and B are incorrect as they do not specifically address the serialization requirement tied to remote EJB operations, while C is misleading since implementing Serializable is not always mandatory.