1 package org.hibernate.test.onetooneformula; 3 4 import java.io.Serializable ; 5 6 9 public class Address implements Serializable { 10 private Person person; 11 private String type; 12 private String street; 13 private String state; 14 private String zip; 15 16 public Person getPerson() { 17 return person; 18 } 19 public void setPerson(Person person) { 20 this.person = person; 21 } 22 public String getState() { 23 return state; 24 } 25 public void setState(String state) { 26 this.state = state; 27 } 28 public String getStreet() { 29 return street; 30 } 31 public void setStreet(String street) { 32 this.street = street; 33 } 34 public String getType() { 35 return type; 36 } 37 public void setType(String type) { 38 this.type = type; 39 } 40 public String getZip() { 41 return zip; 42 } 43 public void setZip(String zip) { 44 this.zip = zip; 45 } 46 47 public boolean equals(Object that) { 48 if ( !(that instanceof Address) ) return false; 49 Address address = (Address) that; 50 return address.getType().equals(type) && 51 address.getPerson().getName().equals( person.getName() ); 52 } 53 54 public int hashCode() { 55 return person.getName().hashCode() + type.hashCode(); 56 } 57 } 58 | Popular Tags |