Class JdbcIdempotencyTableInitializer

java.lang.Object
io.github.ravocode.avoonce.jdbc.JdbcIdempotencyTableInitializer

public final class JdbcIdempotencyTableInitializer extends Object
Plain POJO that creates the idempotency_records table if it does not already exist.

This class has no framework dependencies. It operates directly on a DataSource using standard JDBC, and can be used from any runtime environment:

  • Spring Boot: The idempotency-spring-boot-starter wraps this in an InitializingBean and calls it automatically when avoonce.idempotency.jdbc.auto-ddl=true (the default).
  • JAX-RS / CDI: Call initialize(DataSource) from a @PostConstruct method or an application lifecycle event.
  • Plain Java: Call initialize(DataSource) at application startup before the first request is handled.
  • Constructor Details

    • JdbcIdempotencyTableInitializer

      public JdbcIdempotencyTableInitializer()
  • Method Details

    • initialize

      public void initialize(DataSource dataSource)
      Creates the idempotency_records table and its index if they do not already exist. Safe to call multiple times (idempotent).
      Parameters:
      dataSource - the JDBC data source to execute DDL against.
      Throws:
      IllegalStateException - if a SQLException occurs during DDL execution.