package com.xinhua.xpm.core.model;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Embeddable
public class PrjActivityId implements Serializable{
private static final long serialVersionUID = 2816557576800315617L;
@ManyToOne
@JoinColumn(name="PRJ_ID", nullable=false)
private PrjBaseInfo prjId; //所属项目
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "CREATE_TIME", nullable = false)
private Date createTime; //创建时间
public PrjBaseInfo getPrjId() {
return prjId;
}
public void setPrjId(PrjBaseInfo prjId) {
this.prjId = prjId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public int hashCode() {
return this.prjId.hashCode() + this.createTime.hashCode();
}
@Override
public boolean equals(Object obj) {
if(null == obj){
return false;
}
if(this == obj){
return true;
}
if(obj.getClass() == PrjActivityId.class){
PrjActivityId id = (PrjActivityId)obj;
if(id.getPrjId().equals(this.prjId) && id.getCreateTime().equals(this.createTime)){
return true;
}
}
return false;
}
}
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Embeddable
public class PrjActivityId implements Serializable{
private static final long serialVersionUID = 2816557576800315617L;
@ManyToOne
@JoinColumn(name="PRJ_ID", nullable=false)
private PrjBaseInfo prjId; //所属项目
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "CREATE_TIME", nullable = false)
private Date createTime; //创建时间
public PrjBaseInfo getPrjId() {
return prjId;
}
public void setPrjId(PrjBaseInfo prjId) {
this.prjId = prjId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public int hashCode() {
return this.prjId.hashCode() + this.createTime.hashCode();
}
@Override
public boolean equals(Object obj) {
if(null == obj){
return false;
}
if(this == obj){
return true;
}
if(obj.getClass() == PrjActivityId.class){
PrjActivityId id = (PrjActivityId)obj;
if(id.getPrjId().equals(this.prjId) && id.getCreateTime().equals(this.createTime)){
return true;
}
}
return false;
}
}
@Id
private PrjActivityId id;