Since hibernate 6.3 org.hibernate.annotations.Where and Loader are deprecated.
We are using these annotations together with @NamedQuery and @SQLDelete to implement soft deletion.
What is de non-deprecated way of implementing this?
According to documentation you can replace @Where
annotation to @SQLRestriction
:
From:
@Entity
@Where(clause = "status <> 'DELETED'")
class Document {
...
@Enumerated(STRING)
Status status;
...
}
To:
@Entity
@SQLRestriction("status <> 'DELETED'")
class Document {
...
@Enumerated(STRING)
Status status;
...
}
Also according to documentation you also can replace @Loader
to @SQLSelect
or @HQLSelect
About @HQLSelect
and @SQLSelect
These annotation is just an abbreviation for Loader together with NamedQuery.
More information about HOW TO DO IT I think you should check attached references to documentation about it.