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