1 22 package org.jboss.ejb3.test.composite; 23 24 import javax.persistence.Embeddable; 25 26 32 @Embeddable 33 public class FieldCustomerPK implements java.io.Serializable 34 { 35 public long id; 36 public String name; 37 38 39 public FieldCustomerPK() 40 { 41 } 42 43 public FieldCustomerPK(long id, String name) 44 { 45 this.id = id; 46 this.name = name; 47 } 48 49 public int hashCode() 50 { 51 return (int) id + name.hashCode(); 52 } 53 54 public boolean equals(Object obj) 55 { 56 if (obj == this) return true; 57 if (!(obj instanceof FieldCustomerPK)) return false; 58 if (obj == null) return false; 59 FieldCustomerPK pk = (FieldCustomerPK) obj; 60 return pk.id == id && pk.name.equals(name); 61 } 62 } 63 | Popular Tags |