Oracle神谕

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  284 随笔 :: 9 文章 :: 106 评论 :: 0 Trackbacks

今天在看Jbpm的源代码中,发现其中的Hibernate中的PO的序列化对象基本上都有一个serialVersionUID的一个私有对象,就上网查找了一部分资料。
http://www.javapractices.com/Topic45.cjp
Guidelines for serialVersionUID : (serialVersionUID的指导纲要)

  • always include it as a field, for example: "private static final long serialVersionUID = 7526472295622776147L; " include this field even in the first version of the class, as a reminder(提示) of its importance
  • do not change the value of this field in future versions, unless you are knowingly(老练地) making changes to the class which will render(使..变成) it incompatible(不相容的) with old serialized objects
  • new versions of Serializable classes may or may not be able to read old serialized objects;  it depends upon the nature of the change; provide a pointer to Sun's guidelines for what constitutes a compatible(兼容地) change, as a convenience to future maintainers
posted on 2005-09-17 21:15 java世界畅谈 阅读(501) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: