We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ae8ff39 commit 8c45739Copy full SHA for 8c45739
1 file changed
src/main/java/com/example/solidconnection/entity/common/BaseEntity.java
@@ -12,6 +12,8 @@
12
import java.time.ZoneId;
13
import java.time.ZonedDateTime;
14
15
+import static java.time.temporal.ChronoUnit.MICROS;
16
+
17
@MappedSuperclass
18
@EntityListeners(AuditingEntityListener.class)
19
@Getter
@@ -24,12 +26,12 @@ public abstract class BaseEntity {
24
26
25
27
@PrePersist
28
public void onPrePersist() {
- this.createdAt = ZonedDateTime.now(ZoneId.of("UTC"));
29
+ this.createdAt = ZonedDateTime.now(ZoneId.of("UTC")).truncatedTo(MICROS); // 나노초 6자리 까지만 저장
30
this.updatedAt = this.createdAt;
31
}
32
33
@PreUpdate
34
public void onPreUpdate() {
- this.updatedAt = ZonedDateTime.now(ZoneId.of("UTC"));
35
+ this.updatedAt = ZonedDateTime.now(ZoneId.of("UTC")).truncatedTo(MICROS);
36
37
0 commit comments