package com.lst.lc.entities;
// Generated 2015-7-18 14:55:52 by Hibernate Tools 4.3.1
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
* Question generated by hbm2java
*/
@Entity
@Table(name = "question", catalog = "LearningCommunity")
public class Question implements java.io.Serializable {
private Integer questionId;
private User user;
private String title;
private String content;
private Date time;
private int readNums;
private int answerNums;
private String tag;
private Set<QuestionTag> questionTags = new HashSet<QuestionTag>(0);
private Set<QuestionAnswer> questionAnswers = new HashSet<QuestionAnswer>(0);
public Question() {
}
public Question(User user, String title, String content, Date time,
int readNums, int answerNums) {
this.user = user;
this.title = title;
this.content = content;
this.time = time;
this.readNums = readNums;
this.answerNums = answerNums;
}
public Question(User user, String title, String content, Date time,
int readNums, int answerNums, String tag,
Set<QuestionTag> questionTags, Set<QuestionAnswer> questionAnswers) {
this.user = user;
this.title = title;
this.content = content;
this.time = time;
this.readNums = readNums;
this.answerNums = answerNums;
this.tag = tag;
this.questionTags = questionTags;
this.questionAnswers = questionAnswers;
}
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "questionId", unique = true, nullable = false)
public Integer getQuestionId() {
return this.questionId;
}
public void setQuestionId(Integer questionId) {
this.questionId = questionId;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "authorId", nullable = false)
public User getUser() {
return this.user;
}
public void setUser(User user) {
this.user = user;
}
@Column(name = "title", nullable = false, length = 200)
public String getTitle() {
return this.title;
}
public void setTitle(String title) {
this.title = title;
}
@Column(name = "content", nullable = false, length = 65535)
public String getContent() {
return this.content;
}
public void setContent(String content) {
this.content = content;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "time", nullable = false, length = 19)
public Date getTime() {
return this.time;
}
public void setTime(Date time) {
this.time = time;
}
@Column(name = "readNums", nullable = false)
public int getReadNums() {
return this.readNums;
}
public void setReadNums(int readNums) {
this.readNums = readNums;
}
@Column(name = "answerNums", nullable = false)
public int getAnswerNums() {
return this.answerNums;
}
public void setAnswerNums(int answerNums) {
this.answerNums = answerNums;
}
@Column(name = "tag", length = 200)
public String getTag() {
return this.tag;
}
public void setTag(String tag) {
this.tag = tag;
}
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "questions")
public Set<QuestionTag> getQuestionTags() {
return this.questionTags;
}
public void setQuestionTags(Set<QuestionTag> questionTags) {
this.questionTags = questionTags;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "question")
public Set<QuestionAnswer> getQuestionAnswers() {
return this.questionAnswers;
}
public void setQuestionAnswers(Set<QuestionAnswer> questionAnswers) {
this.questionAnswers = questionAnswers;
}
}