1 package io.oasp.module.jpa.dataaccess.api;
2
3 import javax.persistence.GeneratedValue;
4 import javax.persistence.GenerationType;
5 import javax.persistence.Id;
6 import javax.persistence.MappedSuperclass;
7 import javax.persistence.Transient;
8 import javax.persistence.Version;
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 @MappedSuperclass
25 @Deprecated
26 public abstract class AbstractPersistenceEntity implements MutablePersistenceEntity<Long> {
27
28 private static final long serialVersionUID = 1L;
29
30
31 private Long id;
32
33
34 private int modificationCounter;
35
36
37 private Number revision;
38
39
40
41
42 public AbstractPersistenceEntity() {
43
44 super();
45 }
46
47 @Override
48 @Id
49 @GeneratedValue(strategy = GenerationType.SEQUENCE)
50 public Long getId() {
51
52 return this.id;
53 }
54
55
56
57
58 @Override
59 public void setId(Long id) {
60
61 this.id = id;
62 }
63
64 @Override
65 @Version
66 public int getModificationCounter() {
67
68 return this.modificationCounter;
69 }
70
71 @Override
72 public void setModificationCounter(int version) {
73
74 this.modificationCounter = version;
75 }
76
77 @Override
78 @Transient
79 public Number getRevision() {
80
81 return this.revision;
82 }
83
84
85
86
87 @Override
88 public void setRevision(Number revision) {
89
90 this.revision = revision;
91 }
92
93 @Override
94 public String toString() {
95
96 StringBuilder buffer = new StringBuilder();
97 toString(buffer);
98 return buffer.toString();
99 }
100
101
102
103
104
105
106
107 protected void toString(StringBuilder buffer) {
108
109 buffer.append(getClass().getSimpleName());
110 if (this.id != null) {
111 buffer.append("[id=");
112 buffer.append(this.id);
113 buffer.append("]");
114 }
115 }
116
117 }