Add soft-delete module: @SoftDelete (DELETED/ACTIVE/TIMESTAMP) vs @SQLDelete + @SQLRestriction on Hibernate 7.4.14.Final, H2 and PostgreSQL 17
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b7rnC7jppGGdHGESvy
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package com.ankurm.softdelete;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import org.hibernate.annotations.SoftDelete;
|
||||
|
||||
/**
|
||||
* The default strategy: {@code SoftDeleteType.DELETED}. Hibernate adds a {@code deleted boolean not null}
|
||||
* column (true = removed). The column is NOT a mapped attribute: there is no field for it below.
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "article_deleted")
|
||||
@SoftDelete
|
||||
public class ArticleDeleted {
|
||||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String title;
|
||||
|
||||
protected ArticleDeleted() {}
|
||||
public ArticleDeleted(String title) { this.title = title; }
|
||||
|
||||
public Long getId() { return id; }
|
||||
public String getTitle() { return title; }
|
||||
public void setTitle(String title) { this.title = title; }
|
||||
}
|
||||
Reference in New Issue
Block a user