Campaign repository
CampaignRepository
The CampaignRepository
interface provides access to Campaign
entities in the database. It extends several standard Spring Data interfaces and includes support for safe entity retrieval within a transaction using SynchronousAccessRepository
.
Repository Example:
Inherited Interfaces:
JpaRepository
— provides basic CRUD operationsJpaSpecificationExecutor
— enables filtering support viaCampaignFilter
SynchronousAccessRepository
— a custom interface from timveroOS that provides thegetSync(id)
method: This method ensures the entity is retrieved with a lock until the current transaction completes — which is crucial for concurrent access scenarios (e.g., during automatic campaign executions)
Additional Methods:
This method is used by the CampaignExecutionProducer component to retrieve all active automatic campaigns scheduled for execution.
Usage Example:
The getSync
method ensures that the retrieved Campaign
entity is synchronized with the current transaction — which is critical for components operating in a distributed environment or when using Shedlock.
Last updated
Was this helpful?