Skip to content

Commit f6dcf90

Browse files
Identity Field Pattern
1 parent 0dd7e6d commit f6dcf90

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

Identity_Field/pom.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,22 @@
6161
<groupId>jakarta.persistence</groupId>
6262
<artifactId>jakarta.persistence-api</artifactId>
6363
</dependency>
64+
<dependency>
65+
<groupId>jakarta.persistence</groupId>
66+
<artifactId>jakarta.persistence-api</artifactId>
67+
</dependency>
68+
<dependency>
69+
<groupId>jakarta.persistence</groupId>
70+
<artifactId>jakarta.persistence-api</artifactId>
71+
</dependency>
72+
<dependency>
73+
<groupId>jakarta.persistence</groupId>
74+
<artifactId>jakarta.persistence-api</artifactId>
75+
</dependency>
76+
<dependency>
77+
<groupId>jakarta.persistence</groupId>
78+
<artifactId>jakarta.persistence-api</artifactId>
79+
</dependency>
6480
</dependencies>
6581

6682
</project>
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
package com.iluwater.fieild;
22

3-
43
import jakarta.persistence.Id;
54
import jakarta.persistence.GeneratedValue;
65
import jakarta.persistence.GenerationType;
6+
import javax.persistence.MappedSuperclass;
77

88
@MappedSuperclass
99
public abstract class DomainObject {
10+
@lombok.Setter
11+
@lombok.Getter
1012
@Id
1113
@GeneratedValue(strategy = GenerationType.IDENTITY) // automatically generate unique values for primary key columns
1214
//strategy = GenerationType.IDENTITY generate the primary key value by the database itself using the auto-increment column option
13-
private Long id;
14-
15-
public Long getId() {
16-
return id;
17-
}
15+
private Integer id;
1816

19-
public void setId(Long id) {
20-
this.id = id;
21-
}
2217
}

0 commit comments

Comments
 (0)