Make policy store reads transactional for off-request scheduled triggers

This commit is contained in:
a
2026-06-13 09:20:51 +01:00
parent 33dad0f81a
commit 403627101f
@@ -60,12 +60,17 @@ public class JpaPolicyStore implements PolicyStore {
}
@Override
@Transactional
public List<Policy> all() {
return repository.listAll().stream().map(this::toPolicy).toList();
}
@Override
@Transactional
public List<Policy> findByTriggerType(String triggerType) {
// @Transactional is required even for reads: the scheduled folder-watch/schedule triggers
// call this from a background virtual-thread executor where no request context or
// transaction is active, so Panache would otherwise throw ContextNotActiveException.
return repository.findByTriggerTypeAndEnabledTrue(triggerType).stream()
.map(this::toPolicy)
.toList();