CampaignExecution Repository

CampaignExecutionRepository

Purpose CampaignExecutionRepository is a JPA repository designed for accessing CampaignExecutionarrow-up-right entities. It provides standard CRUD operations, specification-based filtering, and synchronous access in transactional scenarios.


Code Example

public interface CampaignExecutionRepository extends
        JpaRepository<CampaignExecution, Long>,
        JpaSpecificationExecutor<CampaignExecution>,
        SynchronousAccessRepository<CampaignExecution, Long> {

    @Query("select e.id from CampaignExecution e where e.status = 'NEW' order by e.id desc limit 1")
    Optional<Long> findNewExecutionId();
}

Inherited Interfaces

  • JpaRepository — standard CRUD methods

  • JpaSpecificationExecutor — filtering support via Spring Specifications

  • SynchronousAccessRepository — provides getSync(id) method, which blocks reading until the end of the current transaction

SynchronousAccessRepository is a timveroOS interface that guarantees consistent data access in multithreaded environments — especially important for use with CampaignExecutionConsumerarrow-up-right.


Key Method

This method is used by CampaignExecutionConsumerarrow-up-right to select the latest NEW execution ready to be launched.


Usage Example

Last updated

Was this helpful?