1 package org.hibernate.test.annotations.referencedcolumnname; 3 4 import javax.persistence.Entity; 5 import javax.persistence.Id; 6 import javax.persistence.ManyToOne; 7 import javax.persistence.JoinColumn; 8 import javax.persistence.GeneratorType; 9 10 13 @Entity 14 public class House { 15 private Integer id; 16 private String address; 17 private Postman postman; 18 19 @ManyToOne 20 @JoinColumn(referencedColumnName = "name") 21 public Postman getPostman() { 22 return postman; 23 } 24 25 public void setPostman(Postman postman) { 26 this.postman = postman; 27 } 28 29 @Id(generate = GeneratorType.AUTO) 30 public Integer getId() { 31 return id; 32 } 33 34 public void setId(Integer id) { 35 this.id = id; 36 } 37 38 public String getAddress() { 39 return address; 40 } 41 42 public void setAddress(String address) { 43 this.address = address; 44 } 45 } 46 | Popular Tags |