Re: How to determine whether we should make our Data Transfer Objects serializable
Friday, February 2, 2007 11:51 PM
No disadvantage that I know of. In fact it might be an advantage sometime in the future, if you start doing something where they do need to be Serializable.
For example, if you set them as attributes in session scope, in a web application, they are supposed to be Serializable.
Some servlet containers will throw a nasty exception on your web application, if you try to set non-serializable objects in session scope... especially if they are clustered where a session may get replicated between multiple servers, because all the attributes get serialized and de-serialized along the way, in this replication.... or persistence, too, if the servlet container does something to persist its session scope attributes to backing storage, it might need to serialize them then too.