Reputation: 219
I have a class with the following fields and i want to persist it to a file.But it is throwing the following exception... java.io.NotSerializableException: **.VehicleDetailsCollection .
public class VehicleDetailsCollectionWrapper implements java.io.Serializable{
private String updatedTime;
private Map<String,VehicleDetailsCollection> vehicleDetailsDTOList;
********************
********************
}
Upvotes: 1
Views: 1494
Reputation: 45060
Even your VehicleDetailsCollection
class should implement the Serializable
interface.
Implementing Serializable
in VehicleDetailsCollectionWrapper
class makes only the wrapper serializable and not the VehicleDetailsCollection
class.
Upvotes: 3
Reputation: 68715
You need to make VehicleDetailsCollection
class also Serializable.
Read Java serialization specs for more:
http://docs.oracle.com/javase/7/docs/platform/serialization/spec/serial-arch.html
Upvotes: 2