1 package org.hibernate.test.typedonetoone; 3 4 import java.io.Serializable ; 5 6 9 public class AddressId implements Serializable { 10 private String type; 11 private String customerId; 12 13 public AddressId(String type, String customerId) { 14 this.customerId = customerId; 15 this.type = type; 16 } 17 18 public AddressId() {} 19 20 public String getType() { 21 return type; 22 } 23 public void setType(String type) { 24 this.type = type; 25 } 26 public String getCustomerId() { 27 return customerId; 28 } 29 public void setCustomerId(String customerId) { 30 this.customerId = customerId; 31 } 32 public boolean equals(Object other) { 33 if ( !(other instanceof AddressId) ) return false; 34 AddressId add = (AddressId) other; 35 return type.equals(add.type) && customerId.equals(add.customerId); 36 } 37 public int hashCode() { 38 return customerId.hashCode() + type.hashCode(); 39 } 40 41 } 42 | Popular Tags |