1 22 package org.jboss.ejb3.test.singletableinheritance; 23 24 import javax.persistence.DiscriminatorColumn; 25 import javax.persistence.DiscriminatorType; 26 import javax.persistence.Entity; 27 import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; 28 import javax.persistence.Id; 29 import javax.persistence.Inheritance; 30 import javax.persistence.InheritanceType; 31 import javax.persistence.Version; 32 33 36 @Entity 37 @Inheritance(strategy = InheritanceType.SINGLE_TABLE) 38 @DiscriminatorColumn(name = "person_type", discriminatorType = DiscriminatorType.STRING) 39 public class Person 40 { 41 private long id; 42 private String name; 43 private String address; 44 private String zip; 45 private String country; 46 private char sex; 47 private int version; 48 49 @Id @GeneratedValue(strategy=GenerationType.AUTO) 50 public long getId() 51 { 52 return id; 53 } 54 55 public void setId(long id) 56 { 57 this.id = id; 58 } 59 60 public char getSex() 61 { 62 return sex; 63 } 64 65 public void setSex(char sex) 66 { 67 this.sex = sex; 68 } 69 70 public String getName() 71 { 72 return name; 73 } 74 75 public void setName(String identity) 76 { 77 this.name = identity; 78 } 79 80 public String getCountry() 81 { 82 return country; 83 } 84 85 public void setCountry(String country) 86 { 87 this.country = country; 88 } 89 90 public String getZip() 91 { 92 return zip; 93 } 94 95 public void setZip(String zip) 96 { 97 this.zip = zip; 98 } 99 100 public String getAddress() 101 { 102 return address; 103 } 104 105 public void setAddress(String address) 106 { 107 this.address = address; 108 } 109 110 @Version 111 public int getVersion() 112 { 113 return version; 114 } 115 116 public void setVersion(int version) 117 { 118 this.version = version; 119 } 120 } 121 | Popular Tags |