Is it necessary that a Java Bean implements the Serializable interface?
Is it necessary that a Java Bean implements the Serializable interface?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s one of the “typical” features as described in the Javabeans specification.
Here’s an extract of chapter 2.1 What is a bean?
And here’s an extract of chapter 5.5 Summary of Persistence:
In practice, it’s not explicitly necessary for it to function. It will in general also just work fine without implementing
Serializable. It’s however useful whenever you’d like to store them “plain” on harddisk or send “plain” over network. For example when it’s a session scoped bean which is to be stored in the HTTP session and the server is been confugured to persist and revive HTTP sessions during shutdown/restart. At any way, whenever you face aNotSerializableExceptionwith the bean’s full qualified classname in the message, then it’s enough sign to let it implementSerializable.