SSH环境中,使用注解式开发,当实体类中互相注明manytoone和onetomany关系后启动tomcat报404错误

梦幻之城 发布于 2014/05/16 09:17
阅读 650
收藏 0
@Entity
@Table(name="Z_TENDER")
public class Tender implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7134976818868213640L;

	private String id;
	private String projectNo; //项目编号
	private String projectName;//项目名称
	private Date createTime;//创建时间
	private Date modifyTime;//修改时间
	private Integer status;//状态       
	private String userId;//用户id
	private String purchaseMethod;//采购方式
	private String mouldId;//对应的标准(大的)模板id
	private String purchaseOrga;//采购机构
	private String address; //地址
	private String deptAddr;//采购单位
	private Date startTime;//招标文件制作时间
	private String qrsNum;//确认书号
	
	private String filePath;
	private String tenInfoId;
	
	private Set<TenderInfo> tenderInfo;
	
	//List<TenderInfo> list;
	//@OneToMany
	//@JoinColumn(name="fk_ztenderId") 
	//public List<TenderInfo> getBidTenderList(){return list;}
	
	@Id
	@Column(name = "ID", unique = true, nullable = false, length = 32)
	@GeneratedValue(generator = "paymentableGenerator")
	@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	
	@OneToMany(mappedBy = "tender")
        public Set<TenderInfo> getTenderInfo() {
            return tenderInfo;
        }
	
	@Column(name = "PROJECT_NO", length = 128)
	public String getProjectNo() {
		return projectNo;
	}
	public void setProjectNo(String projectNo) {
		this.projectNo = projectNo;
	}
	
	@Column(name = "PROJECT_NAME", length = 128)
	public String getProjectName() {
		return projectName;
	}
	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="CREATE_TIME",length=6)
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="MODIFY_TIME",length=6)
	public Date getModifyTime() {
		return modifyTime;
	}
	public void setModifyTime(Date modifyTime) {
		this.modifyTime = modifyTime;
	}
	
	@Column(name = "STATUS")
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	
	@Column(name = "USER_ID", length = 32)
	public String getUserId() {
		return userId;
	}
	public void setUserId(String userId) {
		this.userId = userId;
	}
	
	@Column(name = "PURCHASE_METHOD", length = 128)
	public String getPurchaseMethod() {
		return purchaseMethod;
	}
	public void setPurchaseMethod(String purchaseMethod) {
		this.purchaseMethod = purchaseMethod;
	}
	
	@Column(name = "DEPT_ADDR", length = 160)
	public String getDeptAddr() {
		return deptAddr;
	}
	public void setDeptAddr(String deptAddr) {
		this.deptAddr = deptAddr;
	}
	
	@Column(name = "PURCHASE_ORGA", length = 160)
	public String getPurchaseOrga() {
		return purchaseOrga;
	}
	public void setPurchaseOrga(String purchaseOrga) {
		this.purchaseOrga = purchaseOrga;
	}
	
	@Column(name = "ADDRESS", length = 160)
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	
	@Column(name = "MOULDID", length = 128)
	public String getMouldId() {
		return mouldId;
	}
	public void setMouldId(String mouldId) {
		this.mouldId = mouldId;
	}
	
	@Transient
	public String getFilePath() {
		return filePath;
	}
	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="START_TIME",length=6)
	public Date getStartTime() {
		return startTime;
	}
	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}
	
	@Column(name = "QRS_NUM", length = 200)
	public String getQrsNum() {
		return qrsNum;
	}
	public void setQrsNum(String qrsNum) {
		this.qrsNum = qrsNum;
	}
	
	@Transient
	public String getTenInfoId() {
		return tenInfoId;
	}
	public void setTenInfoId(String tenInfoId) {
		this.tenInfoId = tenInfoId;
	}
	
}

@Entity
@Table(name="T_TENDER_INFO")
public class TenderInfo implements Serializable{
	
	/** */
	private static final long serialVersionUID = -5629295144187908684L;
	private String id;
	private String ztenderId;//关联z_tender主键
	private String projectNo;
	private String projectName;
	private Date createTime;
	private Date modifyTime;
	private Integer status;
	private String userId;
	private String purchaseOrga;
	private String mouldid;
	private String ztenderName;//投标文件名称
	private String bidMan;
	private String bidDeptCat;
	private String bidManMobile;
	private String bidManPhone;
	private Date startTime;
	
	private String filePath;
	private Tender tender;
	
	 //@ManyToOne(cascade={CascadeType.PERSIST,CascadeType.MERGE})
	 //@JoinTable(name="Z_TENDER",joinColumns = @JoinColumn(name="fk_id"),inverseJoinColumns = @JoinColumn(name="fk_ztenderId"))
	 //Tender tender;
	 //public Tender getTender(){return tender;}
	
	//@ManyToOne(cascade = CascadeType.REFRESH, targetEntity = Tender.class)
	//@JoinColumn(name = "tender_id", referencedColumnName = "id", nullable = true, insertable = false, updatable = false)
	
	@Id
	@Column(name = "ID", unique = true, nullable = false, length = 32)
	@GeneratedValue(generator = "paymentableGenerator")
	@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	
	 @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH},fetch = FetchType.LAZY)
	 @JoinColumn(name = "Z_TENDER_ID")
	 public Tender getTender() {
	     return tender;
	  }
	
	@Column(name = "Z_TENDER_ID", length = 32)
	public String getZtenderId() {
		return ztenderId;
	}
	public void setZtenderId(String ztenderId) {
		this.ztenderId = ztenderId;
	}
	
	@Column(name = "PROJECT_NO", length = 128)
	public String getProjectNo() {
		return projectNo;
	}
	public void setProjectNo(String projectNo) {
		this.projectNo = projectNo;
	}
	
	@Column(name = "PROJECT_NAME", length = 256)
	public String getProjectName() {
		return projectName;
	}
	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}
	
	@Transient
	public String getFilePath() {
		return filePath;
	}
	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="CREATE_TIME",length=6)
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="MODIFY_TIME",length=6)
	public Date getModifyTime() {
		return modifyTime;
	}
	public void setModifyTime(Date modifyTime) {
		this.modifyTime = modifyTime;
	}
	
	@Column(name = "STATUS")
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	
	@Column(name="USER_ID",length=32)
	public String getUserId() {
		return userId;
	}
	public void setUserId(String userId) {
		this.userId = userId;
	}
	
	@Column(name="PURCHASE_ORGA",length=160)
	public String getPurchaseOrga() {
		return purchaseOrga;
	}
	public void setPurchaseOrga(String purchaseOrga) {
		this.purchaseOrga = purchaseOrga;
	}
	
	@Column(name="MOULDID",length=32)
	public String getMouldid() {
		return mouldid;
	}
	public void setMouldid(String mouldid) {
		this.mouldid = mouldid;
	}
	
	@Column(name="Z_TENDER_NAME",length=256)
	public String getZtenderName() {
		return ztenderName;
	}
	public void setZtenderName(String ztenderName) {
		this.ztenderName = ztenderName;
	}
	
	@Column(name="BID_MAN",length=160)
	public String getBidMan() {
		return bidMan;
	}
	public void setBidMan(String bidMan) {
		this.bidMan = bidMan;
	}
	
	@Column(name="BID_DEPT_CAT",length=160)
	public String getBidDeptCat() {
		return bidDeptCat;
	}
	public void setBidDeptCat(String bidDeptCat) {
		this.bidDeptCat = bidDeptCat;
	}
	
	@Column(name="BID_MAN_MOBILE",length=32)
	public String getBidManMobile() {
		return bidManMobile;
	}
	public void setBidManMobile(String bidManMobile) {
		this.bidManMobile = bidManMobile;
	}
	
	@Column(name="BID_MAN_PHONE",length=32)
	public String getBidManPhone() {
		return bidManPhone;
	}
	public void setBidManPhone(String bidManPhone) {
		this.bidManPhone = bidManPhone;
	}
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="START_TIME",length=6)
	public Date getStartTime() {
		return startTime;
	}
	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

启动tomcat报404错误,把注解关系去掉后再次启动,能正常使用,请问问题出在哪里呢?



加载中
0
Pan2049
Pan2049
声明应该写在字段上面,而不是GET方法,没有ONETOMANY这种关系时是可以写在GET方法上面的
返回顶部
顶部