1 package org.hibernate.test.typedmanytoone; 3 4 import java.io.Serializable ; 5 6 9 public class AddressId implements Serializable { 10 private String type; 11 private String addressId; 12 13 public AddressId(String type, String customerId) { 14 this.addressId = 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 getAddressId() { 27 return addressId; 28 } 29 public void setAddressId(String customerId) { 30 this.addressId = 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) && addressId.equals(add.addressId); 36 } 37 public int hashCode() { 38 return addressId.hashCode() + type.hashCode(); 39 } 40 41 public String toString() { 42 return type + '#' + addressId; 43 } 44 45 } 46 | Popular Tags |