intermediateSoft Deletes — @SQLDelete, @SQLRestriction/@Where

Does @SQLRestriction's automatic filter apply to a native query you write yourself?

No — the automatic filter only applies to Hibernate-generated SQL (derived queries, JPQL). A raw native query bypasses it entirely and needs its own explicit exclusion condition if soft-deleted rows shouldn't appear in that query's results.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to Why does a bulk JPQL update leave an already-loaded entity in the persistence context stale?← Back to all Spring Data JPA & Hibernate Mastery questions