Skip to content

Commit fcf92a7

Browse files
author
Karolina Karolak
committed
Review ntoes
1 parent a96ca5e commit fcf92a7

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

src/main/java/com/capgemini/training/appointmentbooking/dataaccess/entity/AppointmentEntity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.capgemini.training.appointmentbooking.dataaccess.entity;
22

3-
import java.util.Date;
3+
import java.time.LocalDateTime;
44

55
import com.capgemini.training.appointmentbooking.common.datatype.AppointmentStatus;
66

@@ -36,7 +36,7 @@ public class AppointmentEntity extends BaseEntity {
3636
private TreatmentEntity treatment;
3737

3838
@Column(name="DATE_TIME")
39-
private Date dateTime;
39+
private LocalDateTime dateTime;
4040

4141
@Enumerated(EnumType.STRING)
4242
private AppointmentStatus status;
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.capgemini.training.appointmentbooking.dataaccess.entity;
22

3+
import java.time.Instant;
34
import java.util.Date;
45

56
import jakarta.persistence.Column;
@@ -12,26 +13,27 @@
1213

1314
@MappedSuperclass
1415
@Getter
15-
@Setter
1616
public class BaseEntity {
1717

1818
@Version
19+
@Setter
1920
private int version;
2021

2122
@Column(insertable = true, updatable = false)
22-
private Date created;
23+
private Instant created;
2324

2425
@Column(name="LAST_UPDATED")
25-
private Date lastUpdated;
26+
private Instant lastUpdated;
2627

2728
@PrePersist
2829
public void prePersist() {
29-
setCreated(new Date());
30-
setLastUpdated(new Date());
30+
Instant now = Instant.now();
31+
this.created = now;
32+
this.lastUpdated = now;
3133
}
3234

3335
@PreUpdate
3436
public void preUpdate() {
35-
setLastUpdated(new Date());
37+
this.lastUpdated = Instant.now();
3638
}
3739
}

src/main/java/com/capgemini/training/appointmentbooking/dataaccess/entity/ClientEntity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class ClientEntity extends BaseEntity {
2828

2929
@OneToOne(optional = false, fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST })
3030
private UserEntity user;
31+
3132
@OneToMany(mappedBy = "client", fetch = FetchType.LAZY, orphanRemoval=true, cascade = { CascadeType.PERSIST })
3233
private List<AppointmentEntity> appointments;
3334

0 commit comments

Comments
 (0)