@@ -20,7 +20,11 @@ Soft delete support is defined by 3 main parts -
20
20
[[soft-delete-type]]
21
21
==== Strategy - SoftDeleteType
22
22
23
- Given truth values, there are 2 valid ways to interpret the values stored in the database. This
23
+ Hibernate supports timestamp and truth-based soft delete strategies, configured by the `strategy` attribute of the `@SoftDelete` annotation.
24
+
25
+ The TIMESTAMP strategy tracks the timestamp at which the row was deleted.
26
+
27
+ For truth-based strategies, there are 2 valid ways to interpret the values stored in the database. This
24
28
interpretation is defined by the SoftDeleteType enumeration and can be configured per-usage using
25
29
`@SoftDelete(..., strategy=ACTIVE)` or `@SoftDelete(..., strategy=DELETED)` -
26
30
@@ -43,6 +47,8 @@ ACTIVE::
43
47
The default column name is `active`.
44
48
DELETED::
45
49
The default column name is `deleted`.
50
+ TIMESTAMP::
51
+ The default column name is `deleted`.
46
52
47
53
See <<soft-delete-basic-example>> for an example of customizing the column name.
48
54
@@ -52,8 +58,11 @@ Depending on the conversion type, an appropriate check constraint may be applied
52
58
[[soft-delete-conversion]]
53
59
==== Indicator conversion
54
60
55
- The conversion is defined using a Jakarta Persistence <<basic-jpa-convert,AttributeConverter>>. The domain-type is always
56
- `boolean`. The relational-type can be any type, as defined by the converter; generally `BOOLEAN`, `BIT`, `INTEGER` or `CHAR`.
61
+ When using a truth-based strategy, a conversion can be specified using a Jakarta Persistence <<basic-jpa-convert,AttributeConverter>>.
62
+ The domain-type is always `boolean`.
63
+ The relational-type can be any type, as defined by the converter; generally `BOOLEAN`, `BIT`, `INTEGER` or `CHAR`.
64
+
65
+ NOTE: It is considered an error to specify a conversion with the TIMESTAMP strategy and an exception will be thrown.
57
66
58
67
An explicit conversion can be specified using `@SoftDelete#converter`. See <<soft-delete-basic-example>>
59
68
for an example of specifying an explicit conversion. Explicit conversions can specify a custom converter or leverage
0 commit comments