1 package org.hibernate.test.annotations.manytoone; 3 4 import javax.persistence.Entity; 5 import javax.persistence.FetchType; 6 import javax.persistence.GeneratorType; 7 import javax.persistence.Id; 8 import javax.persistence.ManyToOne; 9 10 14 @Entity 15 public class Car { 16 private Integer id; 17 private Color bodyColor; 18 private Parent owner; 19 20 @Id(generate=GeneratorType.AUTO) 21 public Integer getId() { 22 return id; 23 } 24 25 public void setId(Integer id) { 26 this.id = id; 27 } 28 29 @ManyToOne(fetch = FetchType.EAGER) 30 public Color getBodyColor() { 31 return bodyColor; 32 } 33 34 public void setBodyColor(Color bodyColor) { 35 this.bodyColor = bodyColor; 36 } 37 38 @ManyToOne 39 public Parent getOwner() { 40 return owner; 41 } 42 43 public void setOwner(Parent owner) { 44 this.owner = owner; 45 } 46 } 47 | Popular Tags |