1 package myorg.relex.one2many;
2
3 import java.util.Date;
4
5 import javax.persistence.*;
6
7
8
9
10
11 @Embeddable
12 public class Produce {
13 public static enum Color { RED, GREEN, YELLOW }
14 @Column(length=16)
15 private String name;
16
17 @Enumerated(EnumType.STRING)
18 @Column(length=10)
19 private Color color;
20
21 @Temporal(TemporalType.DATE)
22 private Date expires;
23
24 public Produce() {}
25 public Produce(String name, Color color, Date expires) {
26 this.name = name;
27 this.color = color;
28 this.expires = expires;
29 }
30
31 public String getName() { return name; }
32 public Color getColor() { return color; }
33 public Date getExpires() { return expires; }
34 }