我正在编写一个Play框架实体,它从play.db.ebean.Model
延伸并从eclipse获得此警告:
The serializable class user does not declare a static final serialVersionUID field of type long
任何人都可以向我解释这个吗? play.db.ebean.Model(http://www.playframework.com/documentation/2.0.3/api/java/play/db/ebean/Model.html)没有实现serializable,我的User类也没有,我不明白为什么eclipse会抛出警告。
以下是我的代码的重要部分:
package models;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import javax.persistence.Entity;
import javax.persistence.Id;
import crypto.PasswordHash;
import play.Logger;
import play.db.ebean.Model;
import play.data.validation.*;
@Entity
public class User extends Model {
@Id
@Constraints.Email
private String email;
@Constraints.Required
private String name;
@Constraints.Required
@Constraints.MinLength(5)
private String password;
@Constraints.Min(0)
private Integer rating;
...
}
答案 0 :(得分:1)
虽然在您链接的javadoc中没有这样说,play.db.ebean.Model
实现com.avaje.ebean.bean.EntityBean
(请参阅https://github.com/playframework/play-ebean/blob/master/play-ebean/src/main/java/play/db/ebean/Model.java),而java.io.Serializable
又延伸{{1}}(参见{{3} }})。所以,Eclipse是正确的。