Examples of two organizations working on master-extension patterns using composite keys for any eclipseLink (JPA 2.1) Can share @IdClass
Here is an example
public Class EmployeePK Serializable applies {private long empId; Private long department; Public Employee (PK) {} Public Long-Term Emp () {return.empId; } Public Zero Setampid (long empId) {this.empId = empId; } Public long department () (back to this department); } Public Zero Set Department (Long Section) {This Department = Department; } Public Action Hashod () {Return (int) this.empId.hashCode (); } Public boolean par (object obj) {if (obj == this) back true; If (Obj exampleof EmployeePK) false return! Employee pk pk = (employee pk) obj; Return pk.empId.equals (this.empId) & amp; Amp; Pk.department.equals (this.department); }}
and
@IdClass (Employee PK class) applies @ Anti-Public Class Employee Employee Serial Job {@Id long empId; @ ID @ManyToOne Department Department; ...}
No comments:
Post a Comment