购物网站6:存放上传文件的实体类

来源:互联网 发布:淘宝客类目佣金设置 编辑:程序博客网 时间:2024/05/16 05:48

/**
 * 存放上传的文件
 *
 */
@Entity
public class UploadFile implements Serializable{
 private static final long serialVersionUID = 7291850395925809042L;
 private Integer id;
 private String filepath;
 private Date uploadtime = new Date();
 
 public UploadFile() {}
 
 public UploadFile(String filepath) {
  this.filepath = filepath;
 }
 @Id @GeneratedValue
 public Integer getId() {
  return id;
 }
 public void setId(Integer id) {
  this.id = id;
 }
 @Column(nullable=false,length=80)
 public String getFilepath() {
  return filepath;
 }
 public void setFilepath(String filepath) {
  this.filepath = filepath;
 }
 @Temporal(TemporalType.TIMESTAMP)
 public Date getUploadtime() {
  return uploadtime;
 }
 public void setUploadtime(Date uploadtime) {
  this.uploadtime = uploadtime;
 }
 @Override
 public int hashCode() {
  final int prime = 31;
  int result = 1;
  result = prime * result + ((id == null) ? 0 : id.hashCode());
  return result;
 }
 @Override
 public boolean equals(Object obj) {
  if (this == obj)
   return true;
  if (obj == null)
   return false;
  if (getClass() != obj.getClass())
   return false;
  final UploadFile other = (UploadFile) obj;
  if (id == null) {
   if (other.id != null)
    return false;
  } else if (!id.equals(other.id))
   return false;
  return true;
 }
 
}