EHCache allows for persistance of the cache, and it requires all objects that are being cached to be Serializable. The objects that are being serialized and written to the Disk are being written with ObjectOutputStream开发者_开发技巧, which is fixed in its required fields and UID. link text
My question is: Is there a way to force the serialization [i.e. overwritting writeObject] to force an non-fixed/versioned way? [i.e. protocol buffers, xml, etc]
ObjectOutputStream, which is fixed in its required fields and UID.
No it isn't. It requires a fixed serialVersionUID all right, but it has a lot of flexibility about how much versioning it can support - see the Versioning chapter of the Object Serialization Specification.
精彩评论