Spend the site deletes before the replacements are written

FixMediaService
Ya
30 Agosti 2026, 18:13 UTC
Mwandishi
Kamo
Ahadi ya
7fca46f

Editing a report came back "The bug could not be saved: Internal Server Error" whenever the reporter left a site ticked — so every edit about the title, the description, or the bug/enhancement choice. `update` clears the site rows and writes the new selection back, and the two halves were only in that order in Java. `deleteByBug_Id` is a Spring Data derived delete: it marks the loaded rows removed in the persistence context and issues no SQL. Hibernate's ActionQueue then flushes in a fixed order with EntityInsertAction ahead of EntityDeleteAction, so at commit the replacement row was inserted while the old one was still there and idx_system_bug_site_unique on (BUG_ID, SITE) refused it: duplicate key value violates unique constraint "idx_system_bug_site_unique" insert into system_bug_site (bug_id,site,id) values (...,1,...) Flushing between the two spends the deletes while they are the only thing queued, so the inserts land on an empty selection. The test pins the ordering rather than the call: delete, then flush, then the first save. A second test holds the edit itself to still changing the type and keeping the site, so the ordering is not bought with a no-op.

Mabadiliko yote

Je, unaona nini kuhusu usafiri?

Kila moja ya hizi updates ardhi katika nafasi yako ya kazi moja kwa moja. Kuanza bure na kuangalia kukua wiki baada ya wiki.

Kuwa Huru MileleMtazamo wa bei