1 package ejava.examples.orm.core.annotated;
2
3 import javax.persistence.*;
4
5
6
7
8
9
10 @Entity
11 @Table(name="ORMCORE_EGGBEATER")
12 @TableGenerator(
13 name="eggbeaterGenerator",
14 table="ORMCORE_EB_UID",
15 pkColumnName="UID_ID",
16 pkColumnValue="ORMCORE_EGGBEATER",
17 valueColumnName="UID_VAL",
18 initialValue=7,
19 allocationSize=5
20 )
21 public class EggBeater {
22 @Id
23 @GeneratedValue(strategy=GenerationType.TABLE,
24 generator="eggbeaterGenerator")
25 private long id;
26 private String make;
27
28 public EggBeater() {}
29 public EggBeater(long id) { this.id = id; }
30
31 public long getId() { return id; }
32
33 public String getMake() { return make; }
34 public void setMake(String make) {
35 this.make = make;
36 }
37
38 @Override
39 public String toString() {
40 return new StringBuilder()
41 .append(super.hashCode())
42 .append(", id=").append(id)
43 .append(", make=").append(make)
44 .toString();
45 }
46 }