Persistence
All Beans persist.
A Bean persists by having its properties, fields, and state information saved and restored to and from storage.
You can control the level of serialization that your Beans undergo:
- Automatic: implement
Serializable. Everything gets serialized.
- Selectively exclude fields you do not want serialized by marking with the
transient (or static modifier
- Complete control: implement
Externalizable, and its two methods.
Some important points about working with the Serializable interface:
- Classes that implement
Serializable must have a no-argument constructor.
- There is no need to implement
Serializable in your class if it is already implemented in a superclass.
- All fields but static and transient are serialized. Use the
transient modifier to specify fields you do not want serialized, and to specify classes that are not serializable.