Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b7rnC7jppGGdHGESvy
22 lines
755 B
Java
22 lines
755 B
Java
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; }
|
|
}
|