Skip to content

Commit 6ad1014

Browse files
Converted Product to JPA Entity
1 parent 171c8f4 commit 6ad1014

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/main/java/guru/springframework/domain/Product.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package guru.springframework.domain;
22

3-
import javax.persistence.Entity;
4-
import javax.persistence.GeneratedValue;
5-
import javax.persistence.GenerationType;
6-
import javax.persistence.Id;
3+
import javax.persistence.*;
74
import java.math.BigDecimal;
85

96
/**
@@ -15,6 +12,10 @@ public class Product implements DomainObject{
1512
@Id
1613
@GeneratedValue(strategy = GenerationType.AUTO)
1714
private Integer id;
15+
16+
@Version
17+
private Integer version;
18+
1819
private String description;
1920
private BigDecimal price;
2021
private String imageUrl;
@@ -27,6 +28,14 @@ public void setId(Integer id) {
2728
this.id = id;
2829
}
2930

31+
public Integer getVersion() {
32+
return version;
33+
}
34+
35+
public void setVersion(Integer version) {
36+
this.version = version;
37+
}
38+
3039
public String getDescription() {
3140
return description;
3241
}

0 commit comments

Comments
 (0)