关于jpa @OneToMany 单向外键关联

bbjohn 发布于 2016/01/06 16:19
阅读 2K+
收藏 0

本人配置了@OneToMany 单向外键关联,目前情况是可以级联查询到结果,但是插入的时候主表能正常插入,子表不能插入。junit测试并无报错。插入方法是用的是HibernateTemplate的saveOrUpdate

附代码:

@Entity(name = "ediInteractive")
@Table(name = "TC_EDI_INTERACTIVE")
public class EdiInteractive {

	/**标识  */
	private Integer id;

	/**业务标志  */
	private Integer bizId;

	/**销售单号  */
	private String docno;

	/**创建时间  */
	private Date createdate;

	/**销售日期  */
	private String billdate;

	/**销售数量  */
	private Integer totQty;

	/**销售金额  */
	private BigDecimal totAmtActual;
	
	/**付款类别  */
	private String paymentType;
	
	/**状态  */
	private String status;

	/**错误信息  */
	private String errorMessage;

	/**备用字段1  */
	private String extend1;

	/**备用字段2  */
	private String extend2;

	/**备用字段3  */
	private String extend3;

	/**备用字段4  */
	private BigDecimal extend4;

	/**备用字段5  */
	private BigDecimal extend5;

	//子表list
	private List<EdiInteractiveDetail> detail;
	
	
	/** 版本号 */
	protected Integer versions;
	
	/** 作成日时 */
	protected Date creationDate=new Date();
	
	/** 作成者*/
    protected Integer createdBy;
    
    /** 作成程序 */
    protected Integer programCreatedId;
    
    /** 修改日时 */
    protected Date lastUpdateDate;
    
    /** 修改者 */
    protected Integer lastUpdatedBy;
    
    /** 修改程序 */
    protected Integer programUpdatedId;

	/** 作废日 */
    protected Date abolitionDate;
    
    /** 作废者 */
    protected Integer abolishedBy;
    
    /** 是否删除 */
    protected String activeFlag;
    
	
	/**
	  * 构造函数<br>
	  */
	public EdiInteractive() {
	}
	
	/**
	  * 全部属性构造函数<br>
	  *
	  * @param id 标识<br>
	  * @param bizId 业务标志<br>
	  * @param docno 销售单号<br>
	  * @param createdate 创建时间<br>
	  * @param billdate 销售日期<br>
	  * @param totQty 销售数量<br>
	  * @param totAmtActual 销售金额<br>
	  * @param paymentType 付款类别<br>
	  * @param status 状态<br>
	  * @param errorMessage 错误信息<br>
	  * @param extend1 备用字段1<br>
	  * @param extend2 备用字段2<br>
	  * @param extend3 备用字段3<br>
	  * @param extend4 备用字段4<br>
	  * @param extend5 备用字段5<br>
	  */
	public EdiInteractive(Integer id
					,Integer bizId
					,String docno
					,Date createdate
					,String billdate
					,Integer totQty
					,BigDecimal totAmtActual
					,String paymentType
					,String status
					,String errorMessage
					,String extend1
					,String extend2
					,String extend3
					,BigDecimal extend4
					,BigDecimal extend5) {
		// 标识
		this.id = id;
		// 业务标志
		this.bizId = bizId;
		// 销售单号
		this.docno = docno;
		// 创建时间
		this.createdate = createdate;
		// 销售日期
		this.billdate = billdate;
		// 销售数量
		this.totQty = totQty;
		// 销售金额
		this.totAmtActual = totAmtActual;
		// 付款类别
		this.paymentType = paymentType;
		// 状态
		this.status = status;
		// 错误信息
		this.errorMessage = errorMessage;
		// 备用字段1
		this.extend1 = extend1;
		// 备用字段2
		this.extend2 = extend2;
		// 备用字段3
		this.extend3 = extend3;
		// 备用字段4
		this.extend4 = extend4;
		// 备用字段5
		this.extend5 = extend5;
	}
	
	/**
	  * 主键属性构造函数<br>
	  *
	  * @param id 标识<br>
	  */
	public EdiInteractive(Integer id) {
		// 标识
		this.id = id;
	}

	

	public String toString() {
		return "EdiInteractive [id=" + id + ", bizId=" + bizId + ", docno=" + docno + ", createdate=" + createdate
				+ ", billdate=" + billdate + ", totQty=" + totQty + ", totAmtActual=" + totAmtActual + ", paymentType="
				+ paymentType + ", status=" + status + ", errorMessage=" + errorMessage + ", extend1=" + extend1
				+ ", extend2=" + extend2 + ", extend3=" + extend3 + ", extend4=" + extend4 + ", extend5=" + extend5
				+ ", detail=" + detail + ", versions=" + versions + ", creationDate=" + creationDate + ", createdBy="
				+ createdBy + ", programCreatedId=" + programCreatedId + ", lastUpdateDate=" + lastUpdateDate
				+ ", lastUpdatedBy=" + lastUpdatedBy + ", programUpdatedId=" + programUpdatedId + ", abolitionDate="
				+ abolitionDate + ", abolishedBy=" + abolishedBy + ", activeFlag=" + activeFlag + "]";
	}

	/**
	  * 标识设值<br>
	  * 
	  * @param id 标识
	  */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	  * 返回标识的值<br>
	  * 
	  * @return 标识
	  */
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE,generator = "SEQ_TC_EDI_INTERACTIVE")
	@SequenceGenerator(name = "SEQ_TC_EDI_INTERACTIVE", sequenceName = "SEQ_TC_EDI_INTERACTIVE",allocationSize = 1)
	public Integer getId() {
		return id;
	}

	/**
	  * 业务标志设值<br>
	  * 
	  * @param bizId 业务标志
	  */
	public void setBizId(Integer bizId) {
		this.bizId = bizId;
	}

	/**
	  * 返回业务标志的值<br>
	  * 
	  * @return 业务标志
	  */
	@Column(name="BIZ_ID")
	public Integer getBizId() {
		return bizId;
	}

	/**
	  * 销售单号设值<br>
	  * 
	  * @param docno 销售单号
	  */
	public void setDocno(String docno) {
		this.docno = docno;
	}

	/**
	  * 返回销售单号的值<br>
	  * 
	  * @return 销售单号
	  */
	@Column(name="DOCNO")
	public String getDocno() {
		return docno;
	}

	/**
	  * 创建时间设值<br>
	  * 
	  * @param createdate 创建时间
	  */
	public void setCreatedate(Date createdate) {
		this.createdate = createdate;
	}

	/**
	  * 返回创建时间的值<br>
	  * 
	  * @return 创建时间
	  */
	@Column(name="CREATEDATE", columnDefinition="timestamp")
	public Date getCreatedate() {
		return createdate;
	}

	/**
	  * 销售日期设值<br>
	  * 
	  * @param billdate 销售日期
	  */
	public void setBilldate(String billdate) {
		this.billdate = billdate;
	}

	/**
	  * 返回销售日期的值<br>
	  * 
	  * @return 销售日期
	  */
	@Column(name="BILLDATE")
	public String getBilldate() {
		return billdate;
	}

	/**
	  * 销售数量设值<br>
	  * 
	  * @param totQty 销售数量
	  */
	public void setTotQty(Integer totQty) {
		this.totQty = totQty;
	}

	/**
	  * 返回销售数量的值<br>
	  * 
	  * @return 销售数量
	  */
	@Column(name="TOT_QTY")
	public Integer getTotQty() {
		return totQty;
	}

	/**
	  * 销售金额设值<br>
	  * 
	  * @param totAmtActual 销售金额
	  */
	public void setTotAmtActual(BigDecimal totAmtActual) {
		this.totAmtActual = totAmtActual;
	}

	/**
	  * 返回销售金额的值<br>
	  * 
	  * @return 销售金额
	  */
	@Column(name="TOT_AMT_ACTUAL", columnDefinition="java.math.BigDecimal")
	public BigDecimal getTotAmtActual() {
		return totAmtActual;
	}
	
	/**
	  * 付款类别设值<br>
	  * 
	  * @param paymentType 付款类别
	  */
	public void setPaymentType(String paymentType) {
		this.paymentType = paymentType;
	}

	/**
	  * 返回付款类别的值<br>
	  * 
	  * @return 付款类别
	  */
	@Column(name="PAYMENT_TYPE")
	public String getPaymentType() {
		return paymentType;
	}
	
	/**
	  * 状态设值<br>
	  * 
	  * @param status 状态
	  */
	public void setStatus(String status) {
		this.status = status;
	}

	/**
	  * 返回状态的值<br>
	  * 
	  * @return 状态
	  */
	@Column(name="STATUS")
	public String getStatus() {
		return status;
	}

	/**
	  * 错误信息设值<br>
	  * 
	  * @param errorMessage 错误信息
	  */
	public void setErrorMessage(String errorMessage) {
		this.errorMessage = errorMessage;
	}

	/**
	  * 返回错误信息的值<br>
	  * 
	  * @return 错误信息
	  */
	@Column(name="ERROR_MESSAGE", columnDefinition="org.springframework.orm.hibernate3.support.ClobStringType")
	public String getErrorMessage() {
		return errorMessage;
	}

	/**
	  * 备用字段1设值<br>
	  * 
	  * @param extend1 备用字段1
	  */
	public void setExtend1(String extend1) {
		this.extend1 = extend1;
	}

	/**
	  * 返回备用字段1的值<br>
	  * 
	  * @return 备用字段1
	  */
	@Column(name="EXTEND1")
	public String getExtend1() {
		return extend1;
	}

	/**
	  * 备用字段2设值<br>
	  * 
	  * @param extend2 备用字段2
	  */
	public void setExtend2(String extend2) {
		this.extend2 = extend2;
	}

	/**
	  * 返回备用字段2的值<br>
	  * 
	  * @return 备用字段2
	  */
	@Column(name="EXTEND2")
	public String getExtend2() {
		return extend2;
	}

	/**
	  * 备用字段3设值<br>
	  * 
	  * @param extend3 备用字段3
	  */
	public void setExtend3(String extend3) {
		this.extend3 = extend3;
	}

	/**
	  * 返回备用字段3的值<br>
	  * 
	  * @return 备用字段3
	  */
	@Column(name="EXTEND3")
	public String getExtend3() {
		return extend3;
	}

	/**
	  * 备用字段4设值<br>
	  * 
	  * @param extend4 备用字段4
	  */
	public void setExtend4(BigDecimal extend4) {
		this.extend4 = extend4;
	}

	/**
	  * 返回备用字段4的值<br>
	  * 
	  * @return 备用字段4
	  */
	@Column(name="EXTEND4", columnDefinition="java.math.BigDecimal")
	public BigDecimal getExtend4() {
		return extend4;
	}

	/**
	  * 备用字段5设值<br>
	  * 
	  * @param extend5 备用字段5
	  */
	public void setExtend5(BigDecimal extend5) {
		this.extend5 = extend5;
	}

	/**
	  * 返回备用字段5的值<br>
	  * 
	  * @return 备用字段5
	  */
	@Column(name="EXTEND5", columnDefinition="java.math.BigDecimal")
	public BigDecimal getExtend5() {
		return extend5;
	}

    /**
	 * 返回版本号的值<br>
	 * 
	 * @return 版本号
	 */
	@Column(name="VERSIONS")
	public Integer getVersions() {
		return versions;
	}
	
	/**
	 * 版本号设值<br>
	 * 
	 * @param createdBy 版本号
	 */
	public void setVersions(Integer versions) {
		this.versions = versions;
	}
	
	/**
	 * 返回作成日时的值<br>
	 * 
	 * @return 作成日时
	 */
	@Column(name="CREATION_DATE", columnDefinition="timestamp")
	public Date getCreationDate() {
		return creationDate;
	}
	
	/**
	 * 作成日时设值<br>
	 * 
	 * @param creationDate 作成日时
	 */
	
	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}
	
	/**
	 * 返回作成者的值<br>
	 * 
	 * @return 作成者
	 */
	@Column(name="CREATED_BY")
	public Integer getCreatedBy() {
		return createdBy;
	}
	
	/**
	 * 作成者设值<br>
	 * 
	 * @param createdBy 作成者
	 */
	public void setCreatedBy(Integer createdBy) {
		this.createdBy = createdBy;
	}
	
	/**
	 * 返回作成程序的值<br>
	 * 
	 * @return 作成程序
	 */
	@Column(name="PROGRAM_CREATED_ID")
	public Integer getProgramCreatedId() {
		return programCreatedId;
	}
	
	/**
	 * 作成程序设值<br>
	 * 
	 * @param programCreatedId 作成程序
	 */
	public void setProgramCreatedId(Integer programCreatedId) {
		this.programCreatedId = programCreatedId;
	}
	
	/**
	 * 返回修改日时的值<br>
	 * 
	 * @return 修改日时
	 */
	@Column(name="LAST_UPDATE_DATE", columnDefinition="timestamp")
	public Date getLastUpdateDate() {
		return lastUpdateDate;
	}
	
	/**
	 * 修改日时设值<br>
	 * 
	 * @param lastUpdateDate 修改日时
	 */
	public void setLastUpdateDate(Date lastUpdateDate) {
		this.lastUpdateDate = lastUpdateDate;
	}
	
	/**
	 * 返回修改者的值<br>
	 * 
	 * @return 修改者
	 */
	@Column(name="LAST_UPDATED_BY")
	public Integer getLastUpdatedBy() {
		return lastUpdatedBy;
	}
	
	/**
	 * 修改者设值<br>
	 * 
	 * @param lastUpdateBy 修改者
	 */
	public void setLastUpdatedBy(Integer lastUpdatedBy) {
		this.lastUpdatedBy = lastUpdatedBy;
	}
	
	/**
	 * 返回作废日的值<br>
	 * 
	 * @return 作废日
	 */
	@Column(name="ABOLITION_DATE", columnDefinition="timestamp")
	public Date getAbolitionDate() {
		return abolitionDate;
	}
	
	/**
	 * 作废日设值<br>
	 * 
	 * @param abolitionDate 作废日
	 */
	public void setAbolitionDate(Date abolitionDate) {
		this.abolitionDate = abolitionDate;
	}
	
	/**
	 * 返回作废者的值<br>
	 * 
	 * @return 作废者
	 */
	@Column(name="ABOLISHED_BY")
	public Integer getAbolishedBy() {
		return abolishedBy;
	}
	
	/**
	 * 作废者设值<br>
	 * 
	 * @param abolitionBy 作废者
	 */
	public void setAbolishedBy(Integer abolishedBy) {
		this.abolishedBy = abolishedBy;
	}
	
	/**
	 * 返回是否删除的值<br>
	 * 
	 * @return 是否删除
	 */
	@Column(name="ACTIVE_FLAG")
	public String getActiveFlag() {
		return activeFlag;
	}
	
	/**
	 * 是否删除设值<br>
	 * 
	 * @param activeFlag 是否删除
	 */
	public void setActiveFlag(String activeFlag) {
		this.activeFlag = activeFlag;
	}
	
	/**
	 * 返回修改程序的值<br>
	 * 
	 * @return 修改程序
	 */
	@Column(name="PROGRAM_UPDATED_ID")
    public Integer getProgramUpdatedId() {
		return programUpdatedId;
	}

	/**
	 * 修改程序设值<br>
	 * 
	 * @param programUpdatedId 修改程序
	 */
	public void setProgramUpdatedId(Integer programUpdatedId) {
		this.programUpdatedId = programUpdatedId;
	}

	
	/*@OneToMany(cascade={CascadeType.PERSIST,
	        CascadeType.REMOVE,
	        //CascadeType.REFRESH,
	        CascadeType.MERGE}, fetch = FetchType.LAZY, 
			targetEntity = EdiInteractiveDetail.class)      //单项一对多配置
	@JoinColumn(name="EDI_ID", referencedColumnName="id") */ //对应关系 EDI_ID = id
	
    @OneToMany(cascade={CascadeType.ALL}, fetch=FetchType.LAZY )
    @JoinColumn(name="EDI_ID", referencedColumnName = "id")
	public List<EdiInteractiveDetail> getDetail() {
		return detail;
	}

	public void setDetail(List<EdiInteractiveDetail> detail) {
		this.detail = detail;
	}

}



@Entity(name = "ediInteractiveDetail")
@Table(name = "TC_EDI_INTERACTIVE_DETAIL")
public class EdiInteractiveDetail {
	
	/**标识  */
	private Integer id;

	/**主表标志  */
	private Integer ediId;

	/**销售数量  */
	private Integer totQty;

	/**销售金额  */
	private BigDecimal totAmtActual;

	/**付款类别  */
	private String paymentType;

	/**备用字段1  */
	private String extend1;

	/**备用字段2  */
	private String extend2;

	/**备用字段3  */
	private String extend3;

	/**备用字段4  */
	private BigDecimal extend4;

	/**备用字段5  */
	private BigDecimal extend5;


	
	/** 版本号 */
	protected Integer versions;
	
	/** 作成日时 */
	protected Date creationDate=new Date();
	
	/** 作成者*/
    protected Integer createdBy;
    
    /** 作成程序 */
    protected Integer programCreatedId;
    
    /** 修改日时 */
    protected Date lastUpdateDate;
    
    /** 修改者 */
    protected Integer lastUpdatedBy;
    
    /** 修改程序 */
    protected Integer programUpdatedId;

	/** 作废日 */
    protected Date abolitionDate;
    
    /** 作废者 */
    protected Integer abolishedBy;
    
    /** 是否删除 */
    protected String activeFlag;
    
	
	/**
	  * 构造函数<br>
	  */
	public EdiInteractiveDetail() {
	}
	
	/**
	  * 全部属性构造函数<br>
	  *
	  * @param id 标识<br>
	  * @param ediId 主表标志<br>
	  * @param totQty 销售数量<br>
	  * @param totAmtActual 销售金额<br>
	  * @param paymentType 付款类别<br>
	  * @param extend1 备用字段1<br>
	  * @param extend2 备用字段2<br>
	  * @param extend3 备用字段3<br>
	  * @param extend4 备用字段4<br>
	  * @param extend5 备用字段5<br>
	  */
	public EdiInteractiveDetail(Integer id
					,Integer ediId
					,Integer totQty
					,BigDecimal totAmtActual
					,String paymentType
					,String extend1
					,String extend2
					,String extend3
					,BigDecimal extend4
					,BigDecimal extend5) {
		// 标识
		this.id = id;
		// 主表标志
		this.ediId = ediId;
		// 销售数量
		this.totQty = totQty;
		// 销售金额
		this.totAmtActual = totAmtActual;
		// 付款类别
		this.paymentType = paymentType;
		// 备用字段1
		this.extend1 = extend1;
		// 备用字段2
		this.extend2 = extend2;
		// 备用字段3
		this.extend3 = extend3;
		// 备用字段4
		this.extend4 = extend4;
		// 备用字段5
		this.extend5 = extend5;
	}
	
	/**
	  * 主键属性构造函数<br>
	  *
	  * @param id 标识<br>
	  */
	public EdiInteractiveDetail(Integer id) {
		// 标识
		this.id = id;
	}

	

	public String toString() {
		return "EdiInteractiveDetail [id=" + id + ", ediId=" + ediId + ", totQty=" + totQty + ", totAmtActual="
				+ totAmtActual + ", paymentType=" + paymentType + ", extend1=" + extend1 + ", extend2=" + extend2
				+ ", extend3=" + extend3 + ", extend4=" + extend4 + ", extend5=" + extend5 + ", versions=" + versions
				+ ", creationDate=" + creationDate + ", createdBy=" + createdBy + ", programCreatedId="
				+ programCreatedId + ", lastUpdateDate=" + lastUpdateDate + ", lastUpdatedBy=" + lastUpdatedBy
				+ ", programUpdatedId=" + programUpdatedId + ", abolitionDate=" + abolitionDate + ", abolishedBy="
				+ abolishedBy + ", activeFlag=" + activeFlag + "]";
	}

	/**
	  * 标识设值<br>
	  * 
	  * @param id 标识
	  */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	  * 返回标识的值<br>
	  * 
	  * @return 标识
	  */
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE,generator = "SEQ_TC_EDI_INTERACTIVE_DETAIL")
	@SequenceGenerator(name = "SEQ_TC_EDI_INTERACTIVE_DETAIL", sequenceName = "SEQ_TC_EDI_INTERACTIVE_DETAIL",allocationSize = 1)
	public Integer getId() {
		return id;
	}

	/**
	  * 主表标志设值<br>
	  * 
	  * @param ediId 主表标志
	  */
	public void setEdiId(Integer ediId) {
		this.ediId = ediId;
	}

	/**
	  * 返回主表标志的值<br>
	  * 
	  * @return 主表标志
	  */
	@Column(name="EDI_ID")
	public Integer getEdiId() {
		return ediId;
	}

	/**
	  * 销售数量设值<br>
	  * 
	  * @param totQty 销售数量
	  */
	public void setTotQty(Integer totQty) {
		this.totQty = totQty;
	}

	/**
	  * 返回销售数量的值<br>
	  * 
	  * @return 销售数量
	  */
	@Column(name="TOT_QTY")
	public Integer getTotQty() {
		return totQty;
	}

	/**
	  * 销售金额设值<br>
	  * 
	  * @param totAmtActual 销售金额
	  */
	public void setTotAmtActual(BigDecimal totAmtActual) {
		this.totAmtActual = totAmtActual;
	}

	/**
	  * 返回销售金额的值<br>
	  * 
	  * @return 销售金额
	  */
	@Column(name="TOT_AMT_ACTUAL", columnDefinition="java.math.BigDecimal")
	public BigDecimal getTotAmtActual() {
		return totAmtActual;
	}
	
	/**
	  * 付款类别设值<br>
	  * 
	  * @param paymentType 付款类别
	  */
	public void setPaymentType(String paymentType) {
		this.paymentType = paymentType;
	}

	/**
	  * 返回付款类别的值<br>
	  * 
	  * @return 付款类别
	  */
	@Column(name="PAYMENT_TYPE")
	public String getPaymentType() {
		return paymentType;
	}
	

	/**
	  * 备用字段1设值<br>
	  * 
	  * @param extend1 备用字段1
	  */
	public void setExtend1(String extend1) {
		this.extend1 = extend1;
	}

	/**
	  * 返回备用字段1的值<br>
	  * 
	  * @return 备用字段1
	  */
	@Column(name="EXTEND1")
	public String getExtend1() {
		return extend1;
	}

	/**
	  * 备用字段2设值<br>
	  * 
	  * @param extend2 备用字段2
	  */
	public void setExtend2(String extend2) {
		this.extend2 = extend2;
	}

	/**
	  * 返回备用字段2的值<br>
	  * 
	  * @return 备用字段2
	  */
	@Column(name="EXTEND2")
	public String getExtend2() {
		return extend2;
	}

	/**
	  * 备用字段3设值<br>
	  * 
	  * @param extend3 备用字段3
	  */
	public void setExtend3(String extend3) {
		this.extend3 = extend3;
	}

	/**
	  * 返回备用字段3的值<br>
	  * 
	  * @return 备用字段3
	  */
	@Column(name="EXTEND3")
	public String getExtend3() {
		return extend3;
	}

	/**
	  * 备用字段4设值<br>
	  * 
	  * @param extend4 备用字段4
	  */
	public void setExtend4(BigDecimal extend4) {
		this.extend4 = extend4;
	}

	/**
	  * 返回备用字段4的值<br>
	  * 
	  * @return 备用字段4
	  */
	@Column(name="EXTEND4", columnDefinition="java.math.BigDecimal")
	public BigDecimal getExtend4() {
		return extend4;
	}

	/**
	  * 备用字段5设值<br>
	  * 
	  * @param extend5 备用字段5
	  */
	public void setExtend5(BigDecimal extend5) {
		this.extend5 = extend5;
	}

	/**
	  * 返回备用字段5的值<br>
	  * 
	  * @return 备用字段5
	  */
	@Column(name="EXTEND5", columnDefinition="java.math.BigDecimal")
	public BigDecimal getExtend5() {
		return extend5;
	}

    /**
	 * 返回版本号的值<br>
	 * 
	 * @return 版本号
	 */
	@Column(name="VERSIONS")
	public Integer getVersions() {
		return versions;
	}
	
	/**
	 * 版本号设值<br>
	 * 
	 * @param createdBy 版本号
	 */
	public void setVersions(Integer versions) {
		this.versions = versions;
	}
	
	/**
	 * 返回作成日时的值<br>
	 * 
	 * @return 作成日时
	 */
	@Column(name="CREATION_DATE", columnDefinition="timestamp")
	public Date getCreationDate() {
		return creationDate;
	}
	
	/**
	 * 作成日时设值<br>
	 * 
	 * @param creationDate 作成日时
	 */
	
	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}
	
	/**
	 * 返回作成者的值<br>
	 * 
	 * @return 作成者
	 */
	@Column(name="CREATED_BY")
	public Integer getCreatedBy() {
		return createdBy;
	}
	
	/**
	 * 作成者设值<br>
	 * 
	 * @param createdBy 作成者
	 */
	public void setCreatedBy(Integer createdBy) {
		this.createdBy = createdBy;
	}
	
	/**
	 * 返回作成程序的值<br>
	 * 
	 * @return 作成程序
	 */
	@Column(name="PROGRAM_CREATED_ID")
	public Integer getProgramCreatedId() {
		return programCreatedId;
	}
	
	/**
	 * 作成程序设值<br>
	 * 
	 * @param programCreatedId 作成程序
	 */
	public void setProgramCreatedId(Integer programCreatedId) {
		this.programCreatedId = programCreatedId;
	}
	
	/**
	 * 返回修改日时的值<br>
	 * 
	 * @return 修改日时
	 */
	@Column(name="LAST_UPDATE_DATE", columnDefinition="timestamp")
	public Date getLastUpdateDate() {
		return lastUpdateDate;
	}
	
	/**
	 * 修改日时设值<br>
	 * 
	 * @param lastUpdateDate 修改日时
	 */
	public void setLastUpdateDate(Date lastUpdateDate) {
		this.lastUpdateDate = lastUpdateDate;
	}
	
	/**
	 * 返回修改者的值<br>
	 * 
	 * @return 修改者
	 */
	@Column(name="LAST_UPDATED_BY")
	public Integer getLastUpdatedBy() {
		return lastUpdatedBy;
	}
	
	/**
	 * 修改者设值<br>
	 * 
	 * @param lastUpdateBy 修改者
	 */
	public void setLastUpdatedBy(Integer lastUpdatedBy) {
		this.lastUpdatedBy = lastUpdatedBy;
	}
	
	/**
	 * 返回作废日的值<br>
	 * 
	 * @return 作废日
	 */
	@Column(name="ABOLITION_DATE", columnDefinition="timestamp")
	public Date getAbolitionDate() {
		return abolitionDate;
	}
	
	/**
	 * 作废日设值<br>
	 * 
	 * @param abolitionDate 作废日
	 */
	public void setAbolitionDate(Date abolitionDate) {
		this.abolitionDate = abolitionDate;
	}
	
	/**
	 * 返回作废者的值<br>
	 * 
	 * @return 作废者
	 */
	@Column(name="ABOLISHED_BY")
	public Integer getAbolishedBy() {
		return abolishedBy;
	}
	
	/**
	 * 作废者设值<br>
	 * 
	 * @param abolitionBy 作废者
	 */
	public void setAbolishedBy(Integer abolishedBy) {
		this.abolishedBy = abolishedBy;
	}
	
	/**
	 * 返回是否删除的值<br>
	 * 
	 * @return 是否删除
	 */
	@Column(name="ACTIVE_FLAG")
	public String getActiveFlag() {
		return activeFlag;
	}
	
	/**
	 * 是否删除设值<br>
	 * 
	 * @param activeFlag 是否删除
	 */
	public void setActiveFlag(String activeFlag) {
		this.activeFlag = activeFlag;
	}
	
	/**
	 * 返回修改程序的值<br>
	 * 
	 * @return 修改程序
	 */
	@Column(name="PROGRAM_UPDATED_ID")
    public Integer getProgramUpdatedId() {
		return programUpdatedId;
	}

	/**
	 * 修改程序设值<br>
	 * 
	 * @param programUpdatedId 修改程序
	 */
	public void setProgramUpdatedId(Integer programUpdatedId) {
		this.programUpdatedId = programUpdatedId;
	}
	
}



@Component
@Transactional(propagation=Propagation.REQUIRED)
public class EdiServiceImpl implements IEdiService {
	
	@Autowired
	private IEdiInteractiveService ediInteractiveService;
	@Autowired
	private IEdiInteractiveViewService ediInteractiveViewService;
	@Autowired
	private IEdiInteractiveDetailService ediInteractiveDetailService;
	
	/**
	 * @see com.sbm.module.postsales.biz.IEdiInteractiveService#doEdiUpload()
	 */
	/**
	 * TODO 简单描述该方法的实现功能(可选).
	 * @see com.sbm.module.postsales.biz.IEdiService#doEdiUpload()
	 */
	public void doEdiUpload() {
		System.out.println("EDIUPLOAD : BEGIN ------ ");
		
		EdiInteractive obj = new EdiInteractive();
		obj.setBizId(228629);
		obj.setStatus("0");
		
		obj.setDocno("RE1512300000038");
		try {
			obj.setCreatedate(new SimpleDateFormat("yyyy/MM/dd HH🇲🇲ss").parse("2015/12/30 15:57:02"));
		} catch (ParseException e) {
			e.printStackTrace();
		}
		obj.setBilldate("20151230");
		obj.setTotQty(-1);
		obj.setTotAmtActual(new BigDecimal("-5296.0000"));
		obj.setPaymentType("CH");
		
		obj.setErrorMessage("测试");
		obj.setVersions(1);
		obj.setCreationDate(new Date());
		obj.setCreatedBy(1);
		obj.setActiveFlag("1");
		
		EdiInteractiveDetail ediInteractiveDetail = new EdiInteractiveDetail();
		ediInteractiveDetail.setTotQty(-1);
		ediInteractiveDetail.setTotAmtActual(new BigDecimal("-5296.0000"));
		ediInteractiveDetail.setPaymentType("CH");
		ediInteractiveDetail.setVersions(1);
		ediInteractiveDetail.setCreationDate(new Date());
		ediInteractiveDetail.setCreatedBy(1);
		ediInteractiveDetail.setActiveFlag("1");
		
		List<EdiInteractiveDetail> detail = new ArrayList<EdiInteractiveDetail>();
		obj.setDetail(detail);
		
		ediInteractiveService.saveOrUpdate(obj);
		
		//ediInteractiveDetailService.saveOrUpdate(ediInteractiveDetail);
		
		
		//查询出所有满足条件的数据
		/*List<EdiInteractiveView> viewList = ediInteractiveViewService.findAll();
		for (EdiInteractiveView ediInteractiveView : viewList) {
			
		
		
		}*/
		
		//List<EdiInteractive> EdiInteractiveList = ediInteractiveService.findAll();
		//System.out.println(EdiInteractiveList.toString());
		
		System.out.println("EDIUPLOAD : END ------ ");
		
	}
	
}



@Repository
public class BaseHibernateDaoImpl<T> extends HibernateDaoSupport  implements IBaseHibernateDao<T>{

	public void saveOrUpdate(T t) {
		this.getHibernateTemplate().save(t);
	}
	
	public List<T> find(String hql) {
		return this.getHibernateTemplate().find(hql);
	}
	
}




加载中
返回顶部
顶部