1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
   | import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;
 
@Entity
@Table(name = "OUDDEC", catalog = "OZG00UC1")
public class Contract implements java.io.Serializable {
	private static final long serialVersionUID = 1L;
	private ContractId contractId;
 
	public Contract() {	}
 
	public Contract(ContractId id) {
		this.contractId = id;
	}
 
	@EmbeddedId
	@AttributeOverrides({
	@AttributeOverride(name = "ecUserCode", 	column = @Column(name = "EC_USER_CODE", 	nullable = false, length = 8)),
	@AttributeOverride(name = "ecPeriodId", 	column = @Column(name = "EC_PERIOD_ID", 	nullable = false)),
	@AttributeOverride(name = "ecParBuId", 	column = @Column(name = "EC_PAR_BU_ID", 	nullable = false, length = 5)),
	@AttributeOverride(name = "ecParContrN", 	column = @Column(name = "EC_PAR_CONTR_N", 	nullable = false, length = 10)),
             @AttributeOverride(name = "ecParExtN", 	column = @Column(name = "EC_PAR_EXT_N", 	nullable = false, length = 5)) } )
 
	public ContractId getContractId() {
		return contractId;
	}
 
	public void setContractId(ContractId contractId) {
		this.contractId = contractId;
	}
}
 
 
et ma classe ContractId
 
 
@Embeddable
public class ContractId implements java.io.Serializable {
	private static final long serialVersionUID = 1L;
	private String ecUserCode;
	private int ecPeriodId;
	private String ecParBuId;
	private String ecParContrN;
	private String ecParExtN;
 
	public ContractId() {}
 
	public ContractId(String ecUserCode, int ecPeriodId, String ecParBuId,
			String ecParContrN, String ecParExtN) {
		this.ecUserCode = ecUserCode;
		this.ecPeriodId = ecPeriodId;
		this.ecParBuId = ecParBuId;
		this.ecParContrN = ecParContrN;
		this.ecParExtN = ecParExtN;
	}
 
	@Column(name = "EC_USER_CODE", nullable = false, length = 8)
	public String getEcUserCode() {
		return this.ecUserCode;
	}
 
	public void setEcUserCode(String ecUserCode) {
		this.ecUserCode = ecUserCode;
	}
 
	@Column(name = "EC_PERIOD_ID", nullable = false)
	public int getEcPeriodId() {
		return this.ecPeriodId;
	}
 
	public void setEcPeriodId(int ecPeriodId) {
		this.ecPeriodId = ecPeriodId;
	}
 
	@Column(name = "EC_PAR_BU_ID", nullable = false, length = 5)
	public String getEcParBuId() {
		return this.ecParBuId;
	}
 
	public void setEcParBuId(String ecParBuId) {
		this.ecParBuId = ecParBuId;
	}
 
	@Column(name = "EC_PAR_CONTR_N", nullable = false, length = 10)
	public String getEcParContrN() {
		return this.ecParContrN;
	}
 
	public void setEcParContrN(String ecParContrN) {
		this.ecParContrN = ecParContrN;
	}
 
	@Column(name = "EC_PAR_EXT_N", nullable = false, length = 5)
	public String getEcParExtN() {
		return this.ecParExtN;
	}
 
	public void setEcParExtN(String ecParExtN) {
		this.ecParExtN = ecParExtN;
	}
 
	public boolean equals(Object other) {
	}
 
	public int hashCode() {
	}
 
} | 
Partager