日期:2014-05-20 浏览次数:20802 次
/* * @(#)XyuNews.java 1.0 2011-9-14 * * Copyright (c) 1998-2011 ChinaCache * All rights reserved. * */ package com.smartdot.icm.models.xyu.model; import java.io.Serializable; import java.util.Date; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.SequenceGenerator; import javax.persistence.Table; /** * 新闻信息,用来存储新闻的相关信息 * * @version 1.0 2011-9-14 * @author Xyu * */ @Entity @Table(name = "XyuNews", schema = "HL") @SequenceGenerator(name = "seq", allocationSize = 1, sequenceName = "news_seq") public class XyuNews implements Serializable { /* * 本类通过使用Hibernate注解来实现独享关系映射 */ /** * 新闻Id * */ private Integer newsId; /** * 新闻标题 * */ private String newsTitle; /** * 新闻内容 * */ private String newsContent; /** * 新闻时间 * */ private Date newsWriteTime; /** * 新闻编写人 * */ private String newsWriteName; /** * 新闻备注 * */ private String newsRemarks; /** * 新闻的撰写人 * */ private Set<XyuNewsWrite> xyunewswrites = new HashSet<XyuNewsWrite>(0); @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq") public Integer getNewsId() { return newsId; } public void setNewsId(Integer newsId) { this.newsId = newsId; } public String getNewsTitle() { return newsTitle; } public void setNewsTitle(String newsTitle) { this.newsTitle = newsTitle; } public String getNewsContent() { return newsContent; } public void setNewsContent(String newsContent) { this.newsContent = newsContent; } public Date getNewsWriteTime() { return newsWriteTime; } public void setNewsWriteTime(Date newsWriteTime) { this.newsWriteTime = newsWriteTime; } public String getNewsWriteName() { return newsWriteName; } public void setNewsWriteName(String newsWriteName) { this.newsWriteName = newsWriteName; } public String getNewsRemarks() { return newsRemarks; } public void setNewsRemarks(String newsRemarks) { this.newsRemarks = newsRemarks; } @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "xyunews") public Set<XyuNewsWrite> getXyunewswrites() { return xyunewswrites; } public void setXyunewswrites(Set<XyuNewsWrite> xyunewswrites) { this.xyunewswrites = xyunewswrites; } }
/* * @(#)XyuNewsWrite.java 1.0 2011-9-19 * * Copyright (c) 1998-2011 ChinaCache * All rights reserved. * */ package com.smartdot.icm.models.xyu.model; import java.io.Serializable; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.SequenceGenerator; import javax.persistence.Table; /** * 新闻撰写人信息,用来存储撰写人的相关信息 * * @version 1.0 2011-9-19 * @author Xyu * */ @Entity @Table(name = "XyuNewsWrite") @SequenceGenerator(name = "seq", allocationSize = 1, sequenceName = "news_write_seq") public class XyuNewsWrite implements Serializable { /* * 本类通过使用Hibernate注解来实现独享关系映射 */ /** * 撰写人Id * */ private Integer writeId; /** * 撰写人姓名 * */ private String writeName; /** * 撰写人性别 * */ private Integer writeSex; /** * 撰写人年龄 * */ private Integer writeAge; /** * 撰写人简历 * */ private String writeResume; /** * 撰写人今日得分 * */ private String writeScore; /** * 新闻ID 外键 * */ private XyuNews newsId; @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq") public Integer getWriteId() { return writeId; } public void setWriteId(Integer writeId) { this.writeId = writeId; } public String getWriteName() { return writeName; } public void setWriteName(String writeName) { this.writeName = writeName; } public Integer getWriteSex() { return writeSex; } public void setWriteSex(Integer writeSex) { this.writeSex = writeSex; } public Integer getWriteAge() { return writeAge; } public void setWriteAge(Integer writeAge) { this.writeAge = writeAge; } public String getWriteResume() { return writeResume; } public void setWriteResume(String writeResume) { this.writeResume = writeResume; } public String getWriteScore() { return writeScore; } public void setWriteScore(String writeScore) { this.writeScore = writeScore; } @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "NEWSID", nullable = false) public XyuNews getNewsId() { return newsId; } public void setNewsId(XyuNews newsId) { this.newsId = newsId; } }