1 package org.hibernate.test.onetooneformula; 3 4 import java.io.Serializable ; 5 6 9 public class Person implements Serializable { 10 private String name; 11 private Address address; 12 private Address mailingAddress; 13 14 public Address getAddress() { 15 return address; 16 } 17 public void setAddress(Address address) { 18 this.address = address; 19 } 20 public Address getMailingAddress() { 21 return mailingAddress; 22 } 23 public void setMailingAddress(Address mailingAddress) { 24 this.mailingAddress = mailingAddress; 25 } 26 public String getName() { 27 return name; 28 } 29 public void setName(String name) { 30 this.name = name; 31 } 32 33 public boolean equals(Object that) { 34 if ( !(that instanceof Person) ) return false; 35 Person person = (Person) that; 36 return person.getName().equals(name); 37 } 38 39 public int hashCode() { 40 return name.hashCode(); 41 } 42 } 43 | Popular Tags |