Gurus, I have some doubts regarding when to use the interface serializable. I have a very simple application. There is a servlet that invokes some bean. The bean does the jdbc connections and gets a ResultSet. The value object class is initialized from the ResultSet. Now my question is do i need to serialize the value object. If not when would i need serialization in such web applications?
Firstly, I'm no guru, so what you read below should be taken as opinion only.
So, your question is should you implement java.io.Serializable on your value object. It's certainly a reasonable thing to do, but whether you actually do it or not might depend on the answer to your second question.
Do you need to serialize the value object? Well, only you can answer that. You could serialize your object if you wanted to transmit its state, say over a network. You could also use serialization if you wanted to persist your object's state, say to a file or database. The benefit of serialization is that you can easily deserialize the object at the other end, or at a later date.
Typically in my experience of using web applications with relational databases there's no need to use object serialization but I expect it depends on your architecture and requirements.