Home > AI > Backend > SpringBoot > mysql-connector-java >

@MappedSuperclass – Parent

@Data
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class Parent implements Serializable {

    private static final long serialVersionUID = 1L;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "created_at", nullable = false, updatable = false)
    @CreatedDate
    private Date createdAt;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "updated_at", nullable = false)
    @LastModifiedDate
    private Date updatedAt;

}

Leave a Reply