1 6 7 package org.hibernate.test.orphan; 8 9 import java.util.HashSet ; 10 import java.util.Set ; 11 12 13 16 public class User { 17 18 private Integer id; 19 private String userid; 20 private Set mail = new HashSet (); 21 22 public User() { 23 } 24 25 public User(String userid) { 26 this.userid = userid; 27 } 28 29 public Integer getId() { 30 return id; 31 } 32 33 protected void setId(Integer id) { 34 this.id = id; 35 } 36 37 public String getUserid() { 38 return userid; 39 } 40 41 public void setUserid(String userid) { 42 this.userid = userid; 43 } 44 45 public Set getMail() { 46 return mail; 47 } 48 49 private void setMail(Set mail) { 50 this.mail = mail; 51 } 52 53 public Mail addMail(String alias) { 54 Mail mail = new Mail( alias, this ); 55 getMail().add( mail ); 56 return mail; 57 } 58 59 public void removeMail(Mail mail) { 60 getMail().remove( mail ); 61 } 62 } 63 | Popular Tags |