noticeInfo的代码如下@SuppressWarnings("serial")
@Entity
@Table(name = "noticeInfo")
public class NoticeInfoBean implements Serializable {
private Integer noticeId; private String noticeTitle; private String noticeTheme; private Clob noticeContent; private String noticeRe; @Temporal(TemporalType.DATE)
private Date noticeFoundDate; private Integer dayOfAvail; private EmployeeInfoBean employee; public NoticeInfoBean() {
} public Integer getDayOfAvail() {
return dayOfAvail;
} public void setDayOfAvail(Integer dayOfAvail) {
this.dayOfAvail = dayOfAvail;
} @ManyToOne(optional = false, fetch = FetchType.LAZY)
@JoinColumn(name = "employee_id", referencedColumnName = "employeeId")
public EmployeeInfoBean getEmployee() {
return employee;
} public void setEmployee(EmployeeInfoBean employee) {
this.employee = employee;
} public Clob getNoticeContent() {
return noticeContent;
} public void setNoticeContent(Clob noticeContent) {
this.noticeContent = noticeContent;
} public Date getNoticeFoundDate() {
return noticeFoundDate;
} public void setNoticeFoundDate(Date noticeFoundDate) {
this.noticeFoundDate = noticeFoundDate;
} public String getNoticeRe() {
return noticeRe;
} public void setNoticeRe(String noticeRe) {
this.noticeRe = noticeRe;
} public String getNoticeTheme() {
return noticeTheme;
} public void setNoticeTheme(String noticeTheme) {
this.noticeTheme = noticeTheme;
} public String getNoticeTitle() {
return noticeTitle;
} public void setNoticeTitle(String noticeTitle) {
this.noticeTitle = noticeTitle;
} @Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Integer getNoticeId() {
return this.noticeId;
} public void setNoticeId(Integer noticeId) {
this.noticeId = noticeId;
} public int hashCode() {
return (this.noticeId == null) ? 0 : this.noticeId.hashCode();
} public boolean equals(Object object) {
if (object instanceof NoticeInfoBean) {
final NoticeInfoBean obj = (NoticeInfoBean) object;
return (this.noticeId != null) ? this.noticeId.equals(obj.noticeId)
: (obj.noticeId == null);
}
return false;
}
}
@Entity
@Table(name = "noticeInfo")
public class NoticeInfoBean implements Serializable {
private Integer noticeId; private String noticeTitle; private String noticeTheme; private Clob noticeContent; private String noticeRe; @Temporal(TemporalType.DATE)
private Date noticeFoundDate; private Integer dayOfAvail; private EmployeeInfoBean employee; public NoticeInfoBean() {
} public Integer getDayOfAvail() {
return dayOfAvail;
} public void setDayOfAvail(Integer dayOfAvail) {
this.dayOfAvail = dayOfAvail;
} @ManyToOne(optional = false, fetch = FetchType.LAZY)
@JoinColumn(name = "employee_id", referencedColumnName = "employeeId")
public EmployeeInfoBean getEmployee() {
return employee;
} public void setEmployee(EmployeeInfoBean employee) {
this.employee = employee;
} public Clob getNoticeContent() {
return noticeContent;
} public void setNoticeContent(Clob noticeContent) {
this.noticeContent = noticeContent;
} public Date getNoticeFoundDate() {
return noticeFoundDate;
} public void setNoticeFoundDate(Date noticeFoundDate) {
this.noticeFoundDate = noticeFoundDate;
} public String getNoticeRe() {
return noticeRe;
} public void setNoticeRe(String noticeRe) {
this.noticeRe = noticeRe;
} public String getNoticeTheme() {
return noticeTheme;
} public void setNoticeTheme(String noticeTheme) {
this.noticeTheme = noticeTheme;
} public String getNoticeTitle() {
return noticeTitle;
} public void setNoticeTitle(String noticeTitle) {
this.noticeTitle = noticeTitle;
} @Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Integer getNoticeId() {
return this.noticeId;
} public void setNoticeId(Integer noticeId) {
this.noticeId = noticeId;
} public int hashCode() {
return (this.noticeId == null) ? 0 : this.noticeId.hashCode();
} public boolean equals(Object object) {
if (object instanceof NoticeInfoBean) {
final NoticeInfoBean obj = (NoticeInfoBean) object;
return (this.noticeId != null) ? this.noticeId.equals(obj.noticeId)
: (obj.noticeId == null);
}
return false;
}
}
@Entity
@Table(name = "employeeInfo")
public class EmployeeInfoBean implements Serializable {
private Integer employeeId; private String employeeName; private Integer employeeAge; private String employeeSex; private String employeeType; private String employeePwd; private Set<NoticeInfoBean> notice = new HashSet<NoticeInfoBean>(); private Set<NoticePublishInfoBean> noticePublish = new HashSet<NoticePublishInfoBean>(); public EmployeeInfoBean() {
} public Integer getEmployeeAge() {
return employeeAge;
} public void setEmployeeAge(Integer employeeAge) {
this.employeeAge = employeeAge;
} public String getEmployeeName() {
return employeeName;
} public void setEmployeeName(String employeeName) {
this.employeeName = employeeName;
} public String getEmployeePwd() {
return employeePwd;
} public void setEmployeePwd(String employeePwd) {
this.employeePwd = employeePwd;
} public String getEmployeeSex() {
return employeeSex;
} public void setEmployeeSex(String employeeSex) {
this.employeeSex = employeeSex;
} public String getEmployeeType() {
return employeeType;
} public void setEmployeeType(String employeeType) {
this.employeeType = employeeType;
} @Id
public Integer getEmployeeId() {
return this.employeeId;
} public void setEmployeeId(Integer employeeId) {
this.employeeId = employeeId;
} public int hashCode() {
return (this.employeeId == null) ? 0 : this.employeeId.hashCode();
} public boolean equals(Object object) {
if (object instanceof EmployeeInfoBean) {
final EmployeeInfoBean obj = (EmployeeInfoBean) object;
return (this.employeeId != null) ? this.employeeId
.equals(obj.employeeId) : (obj.employeeId == null);
}
return false;
} @OneToMany(mappedBy = "employee", fetch = FetchType.LAZY)
public Set<NoticeInfoBean> getNotice() {
return notice;
} public void setNotice(Set<NoticeInfoBean> notice) {
this.notice = notice;
} @ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "NOTICEEMPLOYEE", joinColumns = { @JoinColumn(name = "employee_id", referencedColumnName = "employeeId") }, inverseJoinColumns = { @JoinColumn(name = "noticeId", referencedColumnName = "notice_id") })
public Set<NoticePublishInfoBean> getNoticePublish() {
return noticePublish;
} public void setNoticePublish(Set<NoticePublishInfoBean> noticePublish) {
this.noticePublish = noticePublish;
}
}
@SuppressWarnings("serial")
@Entity
@Table(name = "noticePublishInfo")
public class NoticePublishInfoBean implements Serializable { private String noticeTitle; @Temporal(TemporalType.DATE)
private Date noticePublishDate; private NoticeInfoBean noticeInfo; private Set<EmployeeInfoBean> addressee = new HashSet<EmployeeInfoBean>(); public NoticePublishInfoBean() {
} @OneToOne(optional = false, fetch = FetchType.LAZY)
@JoinColumn(name = "notice_id", referencedColumnName = "noticeId", nullable = true)
public NoticeInfoBean getNoticeInfo() {
return noticeInfo;
} public void setNoticeInfo(NoticeInfoBean noticeInfo) {
this.noticeInfo = noticeInfo;
} public Date getNoticePublishDate() {
return noticePublishDate;
} public void setNoticePublishDate(Date noticePublishDate) {
this.noticePublishDate = noticePublishDate;
} public String getNoticeTitle() {
return noticeTitle;
} public void setNoticeTitle(String noticeTitle) {
this.noticeTitle = noticeTitle;
} @ManyToMany(mappedBy = "noticePublish", fetch = FetchType.LAZY)
public Set<EmployeeInfoBean> getAddressee() {
return addressee;
} public void setAddressee(Set<EmployeeInfoBean> addressee) {
this.addressee = addressee;
} @Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
result = PRIME * result
+ ((noticeInfo == null) ? 0 : noticeInfo.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 NoticePublishInfoBean other = (NoticePublishInfoBean) obj;
if (noticeInfo == null) {
if (other.noticeInfo != null)
return false;
} else if (!noticeInfo.equals(other.noticeInfo))
return false;
return true;
}}