1 package myorg.entityex.annotated; 2 3 import javax.persistence.*; 4 5 @Entity 6 @Table(name="ENITYEX_COW") 7 public class Cow { 8 @EmbeddedId 9 @AttributeOverrides({ 10 @AttributeOverride(name="name", column=@Column(name="NAME", length=16)) 11 }) 12 private CowPK pk; 13 private int weight; 14 15 public Cow() {} 16 public Cow(CowPK cowPK) { 17 this.pk = cowPK; 18 } 19 20 public CowPK getPk() { return pk; } 21 public void setPk(CowPK pk) { 22 this.pk = pk; 23 } 24 25 public int getWeight() { return weight; } 26 public void setWeight(int weight) { 27 this.weight = weight; 28 } 29 }