Update CreateAt and UpdateAt to use @CreationTimestamp and @UpdateTimestamp annotations respectively
This commit is contained in:
parent
985d7835eb
commit
10f417e961
2 changed files with 10 additions and 0 deletions
|
@ -1,6 +1,9 @@
|
||||||
package com.mixel.docusphere.entity;
|
package com.mixel.docusphere.entity;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
import org.hibernate.annotations.CreationTimestamp;
|
||||||
|
import org.hibernate.annotations.UpdateTimestamp;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@ -25,9 +28,11 @@ public class Document {
|
||||||
@JoinColumn(name = "UserID", nullable = false)
|
@JoinColumn(name = "UserID", nullable = false)
|
||||||
private User user;
|
private User user;
|
||||||
|
|
||||||
|
@CreationTimestamp
|
||||||
@Column(name = "CreatedAt", nullable = false, updatable = false)
|
@Column(name = "CreatedAt", nullable = false, updatable = false)
|
||||||
private LocalDateTime createdAt;
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@UpdateTimestamp
|
||||||
@Column(name = "UpdatedAt", nullable = false)
|
@Column(name = "UpdatedAt", nullable = false)
|
||||||
private LocalDateTime updatedAt;
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@ package com.mixel.docusphere.entity;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
import org.hibernate.annotations.CreationTimestamp;
|
||||||
|
import org.hibernate.annotations.UpdateTimestamp;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -30,9 +33,11 @@ public class User {
|
||||||
@Column(name = "PasswordSalt", nullable = false)
|
@Column(name = "PasswordSalt", nullable = false)
|
||||||
private String passwordSalt;
|
private String passwordSalt;
|
||||||
|
|
||||||
|
@CreationTimestamp
|
||||||
@Column(name = "CreatedAt", nullable = false, updatable = false)
|
@Column(name = "CreatedAt", nullable = false, updatable = false)
|
||||||
private LocalDateTime createdAt;
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@UpdateTimestamp
|
||||||
@Column(name = "UpdatedAt", nullable = false)
|
@Column(name = "UpdatedAt", nullable = false)
|
||||||
private LocalDateTime updatedAt;
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue