1 7 package org.jboss.tutorial.secondary.bean; 8 9 import javax.persistence.Column; 10 import javax.persistence.Entity; 11 import javax.persistence.GeneratorType; 12 import javax.persistence.Id; 13 import javax.persistence.JoinColumn; 14 import javax.persistence.SecondaryTable; 15 import javax.persistence.Table; 16 17 @Entity 18 @Table(name = "CUSTOMER") 19 @SecondaryTable(name = "EMBEDDED_ADDRESS") 20 @JoinColumn(name = "ADDRESS_ID") 21 public class Customer implements java.io.Serializable 22 { 23 private int id; 24 private String first; 25 private String last; 26 private String street; 27 private String city; 28 private String state; 29 private String zip; 30 31 public Customer() 32 { 33 } 34 35 public Customer(String first, String last, String street, String city, String state, String zip) 36 { 37 this.first = first; 38 this.last = last; 39 this.street = street; 40 this.city = city; 41 this.state = state; 42 this.zip = zip; 43 } 44 45 @Id(generate = GeneratorType.AUTO) 46 public int getId() 47 { 48 return id; 49 } 50 51 public void setId(int id) 52 { 53 this.id = id; 54 } 55 56 @Column(name = "FIRST") 57 public String getFirst() 58 { 59 return first; 60 } 61 62 public void setFirst(String first) 63 { 64 this.first = first; 65 } 66 67 @Column(name = "LAST") 68 public String getLast() 69 { 70 return last; 71 } 72 73 public void setLast(String last) 74 { 75 this.last = last; 76 } 77 78 @Column(name = "STREET", secondaryTable = "EMBEDDED_ADDRESS") 79 public String getStreet() 80 { 81 return street; 82 } 83 84 public void setStreet(String street) 85 { 86 this.street = street; 87 } 88 89 @Column(name = "CITY", secondaryTable = "EMBEDDED_ADDRESS") 90 public String getCity() 91 { 92 return city; 93 } 94 95 public void setCity(String city) 96 { 97 this.city = city; 98 } 99 100 @Column(name = "STATE", secondaryTable = "EMBEDDED_ADDRESS") 101 public String getState() 102 { 103 return state; 104 } 105 106 public void setState(String state) 107 { 108 this.state = state; 109 } 110 111 @Column(name = "ZIP", secondaryTable = "EMBEDDED_ADDRESS") 112 public String getZip() 113 { 114 return zip; 115 } 116 117 public void setZip(String zip) 118 { 119 this.zip = zip; 120 } 121 } 122 | Popular Tags |