package com.itant.laf.model; import javax.persistence.*; /** * Created by sjj on 2015/10/24 0024. */ @Entity @Table(name = "blog", schema = "laf", catalog = "") public class BlogEntity { private int id; private String title; private String content; private UserEntity userByUserid; @Id @Column(name = "id", nullable = false, insertable = true, updatable = true) public int getId() { return id; } public void setId(int id) { this.id = id; } @Basic @Column(name = "title", nullable = true, insertable = true, updatable = true, length = 100) public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } @Basic @Column(name = "content", nullable = true, insertable = true, updatable = true, length = 255) public String getContent() { return content; } public void setContent(String content) { this.content = content; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; BlogEntity that = (BlogEntity) o; if (id != that.id) return false; if (title != null ? !title.equals(that.title) : that.title != null) return false; if (content != null ? !content.equals(that.content) : that.content != null) return false; return true; } @Override public int hashCode() { int result = id; result = 31 * result + (title != null ? title.hashCode() : 0); result = 31 * result + (content != null ? content.hashCode() : 0); return result; } @ManyToOne @JoinColumn(name = "userid", referencedColumnName = "id") public UserEntity getUserByUserid() { return userByUserid; } public void setUserByUserid(UserEntity userByUserid) { this.userByUserid = userByUserid; } }