I. BACKGROUND
Last week to develop a function of CRM, the system has automatic paging, you need to add a paging variable in the entity class
// page out Private New PageInfo ();
This would have had no effect, but the class used must implement the serialization interface when pulling away from the interface jar package
And this PageInfo object because in the class of extraction, so the PageInfo class must also be serialized, very uncomfortable
Because the PageInfo class is not developed by us, it is not good to modify this class to implement a serialized interface
Transient is a non-trivial modifier, and its role is reflected in the
Second, transient modifier
Transient is a keyword in the Java language that is used to indicate that a domain is not part of the serialization of that object.
When an object is serialized, the value of the transient variable is not included in the serialized representation, whereas the non-transient variable is included.
// Paging Entities Private transient New PageInfo ();
When you export the interface jar package, you still need to export the PageInfo class, but at least the PageInfo class does not need to implement the serialization interface.
Three, the application scenario
When a class implements a serialization interface, and a variable does not want to be serialized under a class, the variable is modified with transient to prevent the variable from being serialized
Java modifier--transient