package com.ankurm.softdelete; import jakarta.persistence.*; import org.hibernate.annotations.SoftDelete; import org.hibernate.annotations.SoftDeleteType; /** {@code SoftDeleteType.TIMESTAMP}: a nullable timestamp column; NULL = alive, a value = when it was removed. */ @Entity @Table(name = "article_stamped") @SoftDelete(strategy = SoftDeleteType.TIMESTAMP, columnName = "deleted_at", comment = "NULL while the row is alive") public class ArticleStamped { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String title; protected ArticleStamped() {} public ArticleStamped(String title) { this.title = title; } public Long getId() { return id; } public String getTitle() { return title; } }