1 22 package org.jboss.ejb3.test.dependent; 23 24 import javax.persistence.AttributeOverride; 25 import javax.persistence.AttributeOverrides; 26 import javax.persistence.Column; 27 import javax.persistence.Embedded; 28 import javax.persistence.Entity; 29 import javax.persistence.Id; 30 import javax.persistence.GeneratedValue; 31 import javax.persistence.GenerationType; 32 33 38 @Entity 39 public class Customer implements java.io.Serializable 40 { 41 Long id; 42 String name; 43 Address address; 44 FieldAddress address2; 45 46 public 47 Customer() 48 { 49 } 50 51 @Id 52 @GeneratedValue(strategy= GenerationType.IDENTITY) 53 public 54 Long getId() 55 { 56 return id; 57 } 58 59 public 60 String getName() 61 { 62 return name; 63 } 64 65 public 66 void setId(Long long1) 67 { 68 id = long1; 69 } 70 71 public 72 void setName(String string) 73 { 74 name = string; 75 } 76 77 @Embedded 78 public Address getAddress() 79 { 80 return address; 81 } 82 83 public void setAddress(Address address) 84 { 85 this.address = address; 86 } 87 88 @Embedded 89 @AttributeOverrides({ 90 @AttributeOverride(name = "street", column = @Column(name = "street2")), 91 @AttributeOverride(name = "city", column = @Column(name = "city2")), 92 @AttributeOverride(name = "state", column = @Column(name = "state2")), 93 @AttributeOverride(name = "zip", column = @Column(name = "zip2")) 94 }) 95 public FieldAddress getAddress2() 96 { 97 return address2; 98 } 99 100 public void setAddress2(FieldAddress address) 101 { 102 this.address2 = address; 103 } 104 105 } 106 107 | Popular Tags |