1 package ejava.examples.orm.rel; 2 3 import java.io.Serializable; 4 5 import javax.persistence.Column; 6 7 public class MediaCopyPK implements Serializable { 8 private static final long serialVersionUID = 1L; 9 @Column(name="MEDIACOPY_MID") 10 private long mediaId; 11 @Column(name="COPY_NO") 12 private int copyNo; 13 14 public MediaCopyPK() {} 15 public MediaCopyPK(long mediaId, int copyNo) { 16 this.mediaId = mediaId; 17 this.copyNo = copyNo; 18 } 19 public int getCopyNo() { return copyNo; } 20 public void setCopyNo(int copyNo) { 21 this.copyNo = copyNo; 22 } 23 24 public long getMediaId() { return mediaId; } 25 public void setMediaId(long mediaId) { 26 this.mediaId = mediaId; 27 } 28 29 public int hashCode() { 30 return (int)mediaId + copyNo; 31 } 32 public boolean equals(Object obj) { 33 try { 34 if (obj == this) return true; 35 return ((MediaCopyPK)obj).mediaId == mediaId && 36 ((MediaCopyPK)obj).copyNo == copyNo; 37 } 38 catch (Throwable ex) { 39 return false; 40 } 41 } 42 }