1 package org.hibernate.test.cuk; 3 4 import java.io.Serializable ; 5 import java.util.HashSet ; 6 import java.util.Set ; 7 8 11 public class Person implements Serializable { 12 private Long id; 13 private String name; 14 private Address address; 15 private String userId; 16 private boolean deleted; 17 private Set accounts = new HashSet (); 18 21 public String getUserId() { 22 return userId; 23 } 24 27 public void setUserId(String userId) { 28 this.userId = userId; 29 } 30 33 public Address getAddress() { 34 return address; 35 } 36 39 public void setAddress(Address address) { 40 this.address = address; 41 } 42 45 public Long getId() { 46 return id; 47 } 48 51 public void setId(Long id) { 52 this.id = id; 53 } 54 57 public String getName() { 58 return name; 59 } 60 63 public void setName(String name) { 64 this.name = name; 65 } 66 69 public Set getAccounts() { 70 return accounts; 71 } 72 75 public void setAccounts(Set accounts) { 76 this.accounts = accounts; 77 } 78 79 public boolean isDeleted() { 80 return deleted; 81 } 82 83 public void setDeleted(boolean deleted) { 84 this.deleted = deleted; 85 } 86 87 public boolean equals(Object other) { 88 if (other instanceof Person) { 89 Person that = (Person) other; 90 return that.isDeleted() == deleted && that.getUserId().equals(userId); 91 } 92 else { 93 return false; 94 } 95 } 96 97 public int hashCode() { 98 return userId.hashCode(); 99 } 100 } 101 | Popular Tags |