1 package ejava.examples.orm.core.annotated;
2
3 import javax.persistence.*;
4
5
6
7
8
9 @Entity
10 @Table(name="ORMCORE_NAPSACK")
11 public class Napsack {
12 @EmbeddedId
13 private NapsackPK pk;
14 private int size;
15
16 public Napsack() {}
17 public Napsack(String make, String model) {
18 this.pk = new NapsackPK(make, model);
19 }
20
21 public NapsackPK getPk() { return pk; }
22
23 public int getSize() { return size; }
24 public void setSize(int size) {
25 this.size = size;
26 }
27
28 public String toString() {
29 return new StringBuilder()
30 .append(super.toString())
31 .append(", pk=").append(pk)
32 .append(", size=").append(size)
33 .toString();
34 }
35 }