1 package myorg.entityex.annotated; 2 3 import javax.persistence.*; 4 5 @Entity 6 @Table(name="ENITYEX_COW2") 7 @IdClass(CowPK.class) 8 @AttributeOverrides({ 9 @AttributeOverride(name="name", column=@Column(name="NAME", length=16)) 10 }) 11 public class Cow2 { 12 @Id 13 private String herd; 14 @Id 15 private String name; 16 private int weight; 17 18 public Cow2() {} 19 public Cow2(String herd, String name) { 20 this.herd = herd; 21 this.name = name; 22 } 23 24 public String getHerd() { return herd; } 25 public String getName() { return name; } 26 27 public int getWeight() { return weight; } 28 public void setWeight(int weight) { 29 this.weight = weight; 30 } 31 }