1 package ejava.examples.orm.core.annotated;
2
3 import javax.persistence.*;
4
5
6
7
8
9 @Entity
10 @Table(name="ORMCORE_FAN")
11 @SequenceGenerator(
12 name="fanSequence",
13 sequenceName="FAN_SEQ",
14 initialValue=5,
15 allocationSize=3)
16 public class Fan {
17 @Id
18 @GeneratedValue(strategy=GenerationType.SEQUENCE,
19 generator="fanSequence")
20 private long id;
21 private String make;
22
23 public Fan() {}
24 public Fan(long id) { this.id = id; }
25
26 public long getId() { return id; }
27
28 public String getMake() { return make; }
29 public void setMake(String make) {
30 this.make = make;
31 }
32
33 @Override
34 public String toString() {
35 return new StringBuilder()
36 .append(super.hashCode())
37 .append(", id=").append(id)
38 .append(", make=").append(make)
39 .toString();
40 }
41 }