⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newsreview.java

📁 spring+struts+hibernate写的新闻发布系统。
💻 JAVA
字号:
package org.yeeku.model;

import java.util.Date;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * @hibernate.class table="news_review"
 * @struts.form include-all="false" extends="BaseForm"
 */
public class NewsReview extends BaseObject {

	private Long id;//required,pk

	private String content;//required

	private User poster;// fk,required

	private Date postDate;// required

	private Date lastModifyDate;// required

	private News news;// fk,required

	public NewsReview() {
	}

	/**
	 * @hibernate.property column="content" length="500" not-null="true"
	 */
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	/**
	 * @return Returns the id.
	 * @hibernate.id column="id" generator-class="increment"
	 *               unsaved-value="null"
	 */
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @hibernate.property column="last_modify_date" not-null="true"
	 */
	public Date getLastModifyDate() {
		return lastModifyDate;
	}

	public void setLastModifyDate(Date lastModifyDate) {
		this.lastModifyDate = lastModifyDate;
	}

	/**
	 * @hibernate.many-to-one column="id" not-null="true"
	 */
	public News getNews() {
		return news;
	}

	public void setNews(News news) {
		this.news = news;
	}

	/**
	 * @hibernate.property column="post_date" not-null="true"
	 */
	public Date getPostDate() {
		return postDate;
	}

	public void setPostDate(Date postDate) {
		this.postDate = postDate;
	}

	/**
	 * @hibernate.many-to-one column="username" not-null="true"
	 */
	public User getPoster() {
		return poster;
	}

	public void setPoster(User poster) {
		this.poster = poster;
	}

	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof NewsReview)) {
			return false;
		}
		NewsReview rhs = (NewsReview) object;
		return this.poster.equals(rhs.getPoster()) && this.postDate.equals(rhs.getPostDate());
		/*return new EqualsBuilder().append(this.news, rhs.news).append(
				this.content, rhs.content).append(this.postDate, rhs.postDate)
				.append(this.lastModifyDate, rhs.lastModifyDate).append(
						this.id, rhs.id).append(this.poster, rhs.poster)
				.isEquals();*/
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return this.poster.hashCode() + this.postDate.hashCode();
		/*return new HashCodeBuilder(-1152635115, 884310249).append(this.news)
				.append(this.content).append(this.postDate).append(
						this.lastModifyDate).append(this.id)
				.append(this.poster).toHashCode();*/
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this).append("id", this.id).append(
				"postDate", this.postDate).append("lastModifyDate",
				this.lastModifyDate).append("content", this.content).append(
				"poster", this.poster).append("news", this.news).toString();
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -