SHARE
TWEET

BaseModel

a guest Dec 9th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.university.grades.grades.repository.models;
  2.  
  3. import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  4. import org.springframework.data.annotation.CreatedDate;
  5. import org.springframework.data.annotation.LastModifiedDate;
  6. import org.springframework.data.jpa.domain.support.AuditingEntityListener;
  7.  
  8. import javax.persistence.*;
  9. import java.io.Serializable;
  10. import java.util.Date;
  11.  
  12. @MappedSuperclass
  13. @EntityListeners(AuditingEntityListener.class)
  14. @JsonIgnoreProperties(
  15.         value = {"createdAt", "updateAt"},
  16.         allowGetters = true
  17. )
  18. public abstract class BaseModel implements Serializable {
  19.  
  20.     @Temporal(TemporalType.TIMESTAMP)
  21.     @Column(name = "created_at", nullable = false, updatable = false)
  22.     @CreatedDate
  23.     private Date createdAt;
  24.  
  25.     @Temporal(TemporalType.TIMESTAMP)
  26.     @Column(name = "updated_at", nullable = false)
  27.     @LastModifiedDate
  28.     private Date updatedAt;
  29.  
  30.     public Date getCreatedAt() {
  31.         return createdAt;
  32.     }
  33.  
  34.     public void setCreatedAt(Date createdAt) {
  35.         this.createdAt = createdAt;
  36.     }
  37.  
  38.     public Date getUpdatedAt() {
  39.         return updatedAt;
  40.     }
  41.  
  42.     public void setUpdatedAt(Date updatedAt) {
  43.         this.updatedAt = updatedAt;
  44.     }
  45. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top