fix(geschichte): delete note-less journey items before document delete (#805) #806

Merged
marcel merged 8 commits from feat/issue-805-journey-note-less-cascade into feat/issue-795-story-documents 2026-06-11 19:36:06 +02:00
Showing only changes of commit 00baf0d881 - Show all commits

View File

@@ -51,9 +51,10 @@ public interface JourneyItemRepository extends JpaRepository<JourneyItem, UUID>
* Explicit JPQL — same trap as existsByGeschichteIdAndDocumentId: the transient
* getDocumentId() getter makes Spring Data unable to resolve a derived query path.
* clearAutomatically = true invalidates the L1 cache so AC-2's "note-carrying survives"
* assertion never reads a stale entity.
* assertion never reads a stale entity. flushAutomatically = true makes the
* flush-before-delete contract explicit rather than relying on Hibernate AUTO flush mode.
*/
@Modifying(clearAutomatically = true)
@Modifying(clearAutomatically = true, flushAutomatically = true)
@Query("DELETE FROM JourneyItem i WHERE i.document.id = :documentId AND (i.note IS NULL OR i.note = '')")
int deleteNoteLessByDocumentId(@Param("documentId") UUID documentId);