why to use serializable with java bean

Solutions on MaxInterview for why to use serializable with java bean by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "why to use serializable with java bean"
Liam
12 Sep 2017
1/*
2One good reason, with respect to servlets, is that if you put 
3serializable beans into your web server session, your web server can 
4serialize them to disk if it's shutting down, and then deserialize them 
5back into memory when it starts up. In this way, users wouldn't lose 
6their sessions / logins when the server comes back up.
7  
8If there are any non-serializable beans in session, tomcat will fail to 
9serialize sessions to disk.
10I believe it's also necessary if you want to sync sessions between 
11multiple servers in a cluster.
12*/