1 package ejava.examples.orm.core.annotated;
2
3 import javax.persistence.*;
4
5 import org.slf4j.Logger;
6 import org.slf4j.LoggerFactory;
7
8
9
10
11
12
13 @Entity
14 @Table(name="ORMCORE_UMBRELLA")
15 public class Umbrella {
16 private static final Logger log = LoggerFactory.getLogger(Umbrella.class);
17 private long id;
18 private String make;
19 private String model;
20
21 public Umbrella() {
22 trace("ctor()");
23 }
24 public Umbrella(long id) {
25 trace("ctor(" + id + ")");
26 this.id = id;
27 }
28
29 @Id
30 public long getId() {
31 trace("getId()=" + id);
32 return id;
33 }
34 @SuppressWarnings("unused")
35 private void setId(long id) {
36 trace("setId(" + id + ")");
37 this.id = id;
38 }
39
40 @Lob
41 @Basic(fetch=FetchType.LAZY)
42 public char[] getMake() {
43 trace("getMake()=" + make);
44 return make.toCharArray();
45 }
46 public void setMake(char[] make) {
47 trace("setMake(" + new String(make) + ")");
48 this.make = new String(make);
49 }
50
51 public String getModel() {
52 trace("getModel()=" + model);
53 return model;
54 }
55 public void setModel(String model) {
56 trace("setModel(" + model + ")");
57 this.model = model;
58 }
59
60 public String toString() {
61 return new StringBuilder()
62 .append(super.toString())
63 .append("make=").append(make)
64 .append(", model=").append(model)
65 .toString();
66 }
67 private void trace(String message) {
68 log.debug(super.toString() + ":" + message);
69 }
70
71 }