package entity; import java.util.Date; import java.util.HashSet; import java.util.Set; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity public class Keyword{ @Id @GeneratedValue private Integer keywordId; private String title; private String body; private Set<keyword> parents = new HashSet<keyword>(); private Set<keyword> children = new HashSet<keyword>(); private Date lastModifiedTime; private Date createTime; public Integer getKeywordId() { return keywordId; } public void setKeywordId(Integer keywordId) { this.keywordId = keywordId; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getBody() { return body; } public void setBody(String body) { this.body = body; } public Set<keyword> getParents() { return parents; } public void setParents(Set<keyword> parents) { this.parents = parents; } public Set<keyword> getChildren() { return children; } public void setChildren(Set<keyword> children) { this.children = children; } public Date getLastModifiedTime() { return lastModifiedTime; } public void setLastModifiedTime(Date lastModifiedTime) { this.lastModifiedTime = lastModifiedTime; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } }Let's create the necessary Hibernate configurations to let Hibernate know all about our little plan to have Keyword able to join itself! Questions? Let me know!
◀ Create DB TablesCreate Hibernate Configuration ▶