Class MetadataEventSchemaCreator

java.lang.Object
io.hypersistence.optimizer.core.event.persistence.MetadataEventSchemaCreator
All Implemented Interfaces:
EventSchemaCreator

public class MetadataEventSchemaCreator extends Object implements EventSchemaCreator
The MetadataEventSchemaCreator creates, on demand, the database tables used by the event persistence feature.

Instead of hand-written DDL, it relies on Hibernate's own schema migrator: the Metadata of the canonical entity model (HypersistenceOptimizerBootstrapRun, HypersistenceOptimizerBootstrapEvent and HypersistenceOptimizerRuntimeEvent) is built and the missing tables are created from it, so the tables are generated with the exact types and identity strategy of the underlying database dialect, across every database Hibernate supports. The short-lived service registry borrows connections from the host application's pool (via HostConnectionProvider) and is destroyed immediately after the schema has been created; it is only used for DDL, never to persist events (those are written with plain JDBC by EventStore).

Since:
2.14.0
Author:
Vlad Mihalcea
  • Constructor Details

  • Method Details

    • createSchema

      public void createSchema()
      Apply CREATE using the canonical IDENTITY mappings. This does not introduce sequence generators.
      Specified by:
      createSchema in interface EventSchemaCreator