1 | |
package org.kuali.student.core.entity; |
2 | |
|
3 | |
import javax.persistence.Column; |
4 | |
import javax.persistence.Id; |
5 | |
import javax.persistence.MappedSuperclass; |
6 | |
import javax.persistence.PrePersist; |
7 | |
import javax.persistence.PreUpdate; |
8 | |
import javax.persistence.Version; |
9 | |
|
10 | |
import org.kuali.student.common.util.UUIDHelper; |
11 | |
|
12 | |
@MappedSuperclass |
13 | 0 | public abstract class BaseEntity { |
14 | |
|
15 | |
@Id |
16 | |
@Column(name = "ID") |
17 | |
private String id; |
18 | |
|
19 | |
@Version |
20 | |
@Column(name="VER_NBR") |
21 | |
private Long versionNumber; |
22 | |
|
23 | |
@Column(name="OBJ_ID",length=KSEntityConstants.OBJ_ID_LENGTH) |
24 | |
private String objectId; |
25 | |
|
26 | |
public String getObjectId() { |
27 | 0 | return objectId; |
28 | |
} |
29 | |
|
30 | |
public void setObjectId(String objectId) { |
31 | 0 | this.objectId = objectId; |
32 | 0 | } |
33 | |
|
34 | |
@PrePersist |
35 | |
public void prePersist(){ |
36 | |
|
37 | 0 | this.id = UUIDHelper.genStringUUID(this.id); |
38 | 0 | this.objectId = UUIDHelper.genStringUUID(); |
39 | 0 | onPrePersist(); |
40 | 0 | } |
41 | |
|
42 | |
@PreUpdate |
43 | |
public void preUpdate(){ |
44 | 0 | onPreUpdate(); |
45 | 0 | } |
46 | |
|
47 | |
|
48 | |
|
49 | |
protected void onPrePersist() { |
50 | 0 | } |
51 | |
|
52 | |
|
53 | |
protected void onPreUpdate() { |
54 | 0 | } |
55 | |
|
56 | |
public Long getVersionNumber() { |
57 | 0 | return versionNumber; |
58 | |
} |
59 | |
|
60 | |
public void setVersionNumber(Long versionNumber) { |
61 | 0 | this.versionNumber = versionNumber; |
62 | 0 | } |
63 | |
|
64 | |
public String getId() { |
65 | 0 | return id; |
66 | |
} |
67 | |
|
68 | |
public void setId(String id) { |
69 | 0 | this.id = id; |
70 | 0 | } |
71 | |
|
72 | |
} |