KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > test > hql > CrazyCompositeKey


1 // $Id: CrazyCompositeKey.java,v 1.2 2005/05/31 20:24:41 oneovthafew Exp $
2
package org.hibernate.test.hql;
3
4 import java.io.Serializable JavaDoc;
5
6 /**
7  * Implementation of CrazyCompositeKey.
8  *
9  * @author Steve Ebersole
10  */

11 public class CrazyCompositeKey implements Serializable JavaDoc {
12     private Long JavaDoc id;
13     private Long JavaDoc otherId;
14
15     public Long JavaDoc getId() {
16         return id;
17     }
18
19     public void setId(Long JavaDoc id) {
20         this.id = id;
21     }
22
23     public Long JavaDoc getOtherId() {
24         return otherId;
25     }
26
27     public void setOtherId(Long JavaDoc otherId) {
28         this.otherId = otherId;
29     }
30     
31     public boolean equals(Object JavaDoc that) {
32         CrazyCompositeKey cck = (CrazyCompositeKey) that;
33         return cck.id.longValue() == id.longValue()
34             && cck.otherId.longValue() == otherId.longValue();
35     }
36     
37     public int hashCode() {
38         return id.hashCode() + otherId.hashCode();
39     }
40 }
41
Popular Tags