serialVersionUID作用: 
序列化时为了保持版本的兼容性,即在版本升级时反序列化仍保持对象的唯一性。

在Eclipse中可以自动生成,有两种生成方式: 
一个是默认的1L,比如:private static final long serialVersionUID = 1L; 
一个是根据类名、接口名、成员方法及属性等来生成一个64位的哈希字段,比如:private static final long serialVersionUID = -8940196742313994740L。

当你一个类实现了Serializable接口,如果没有定义serialVersionUID,Eclipse会提供这个提示功能告诉你去定义它。 
如果不想定义它,在Eclipse的设置中将其关掉,设置如下: 
Window ==> Preferences ==> Java ==> Compiler ==> Error/Warnings ==> Potential programming problems 
将Serializable class without serialVersionUID的warning改成ignore即可。

Eclipse警告:The serializable class XXX does not declare a static final serialVersionUID field of type long的更多相关文章

  1. 关于The serializable class XXX does not declare a static final serialVersionUID field of type long的警告

    编写实体类并且继承序列化接口时候,实体类会有警告,要生成一个静态的serialVersionUID. 上网搜了一下资料,现通俗解释一下: 点击前2个选项,会生成: private static fin ...

  2. The serializable class XXX does not declare a static final serialVersionUID field of type long

    问题: 在Eclipse中,继承类时,总是提示下面的警告(Warning),按理说警告是没有关系的,但是程序看起来老不爽了,这是强迫症的关系(呵呵) The serializable class XX ...

  3. The serializable class XXX does not declare a static final serialVersionUID field of type long的警告

    原文: http://blog.csdn.net/ultrakang/article/details/41820543

  4. Eclipse下关于The serializable class UsersServlet does not declare a static final serialVersionUID field of type的警告

    The serializable class XXX does not declare a static final serialVersionUID field of type long seria ...

  5. The serializable class does not declare a static final serialVersionUID field of type long

    在编译以下Java程序时,出现The serializable class  does not declare a static final serialVersionUID field of typ ...

  6. the serializable class XXX does not declare a static final seriaVersionUID...的问题

    关于myeclips提示The serializable class XXX does not declare a static final serialVersionUID field of typ ...

  7. java 输入输出 对象序列化implements Serializable与反序列化:ObjectOutputStream.writeObject() ;objectInputStream.readObject() ;serialVersionUID字段注意

    对象序列化 对象序列化的目标是将对象保存到磁盘中,或允许在网络中直接传输对象.对象序列化机制允许把内存中的 Java 对象转换成平台无关的二进制流,从而允许把这种二进制流持久地保存在磁盘上,通过网络将 ...

  8. 警告"Local declaration of 'XXX' hides instance variable"原因

    Local declaration of 'XXX' hides instance variable   是因为本地变量名跟函数变量名同名 ,.在命名上要注意.....  

  9. Eclipse 报错The method xxx of type must override a superclass method、Description Resource Path Location Type Java compiler level does not match the version of the installed Java project facet

    问题: 如上图, 没改钱@Override会报错The method run() of type must override a superclass method 原因: java1.5中继承接口是 ...

随机推荐

  1. 【1】JVM-内存模型

    本篇其实就是一个读书笔记,书是<深入理解JAVA虚拟机>,在网上搜索JAVA内存,说的比较好的其实很多都源自这本书,作为一个JAVA程序员,理解虚拟机是通向高级程序员的必经道路.本篇中的图 ...

  2. 【转】【Centos】nginx配置:location配置方法及实例详解

    location匹配的是nginx的哪个变量? $request_uri location的匹配种类有哪些? 格式 location [ 空格 | = | ~ | ~* |^~ | !~ | !~* ...

  3. git 在命令行与图形状态下使用详情

    http://blog.csdn.net/risky78125/article/details/50850545 http://blog.csdn.net/risky78125/article/det ...

  4. #HTTP协议学习# (八)状态码详解

    可直接参考:http://www.cnblogs.com/TankXiao/archive/2013/01/08/2818542.html

  5. Websphere多个应用session相互覆盖问题解决办法

    原文链接:http://my.oschina.net/moyuqi/blog/98475 使用apache反向代理解决在应用A使用Iframe嵌入应用B的功能而产生的跨域问题后,应用B的功能能正常使用 ...

  6. Linux 系统强制踢掉登录用户并禁止用户再次登录系统

    标注:创建一个test测试用户,test用户使用Xshel工具ssh远程登录linux操作系统. 强制踢掉登录用户方法一: [root@cloucentos6 ~]# w               ...

  7. HTTP 错误 500.19 配置文件错误 ( 0x8007000d,0x80070032)

    HTTP 错误 500.19 - Internal Server Error无法访问请求的页面,因为该页的相关配置数据无效. 详细错误信息模块 IIS Web Core 通知 未知 处理程序 尚未确定 ...

  8. ORA-01033错误解决方案

    现象:SQL*Plus无法连接,显示以下错误: ORA-01033 : ORACLE initialization or shutdown in progress 分析:应该是Oracle在启动后,用 ...

  9. 如何解析oracle执行计划

    要执行任何SQL语句,Oracle 必须推导出一个“执行计划”.查询的执行计划是 Oracle 将如何实现数据的检索,以满足给定 SQL 语句的描述.它只不过是其中包含的步骤及它们之间关系的顺序树.执 ...

  10. 【Ubuntu】录屏软件

    http://www.leesven.com/2378.html sudo apt-get install kazam