Class EventStore
java.lang.Object
io.hypersistence.optimizer.core.event.persistence.EventStore
The
EventStore persists events into the database using plain JDBC and batched
INSERT statements.
The tables are keyed by a database IDENTITY column, so the writes work reliably across
multiple application nodes without any application-generated identifiers. The JDBC
Connection is borrowed from the host application's SessionFactory through the
ConnectionExecutor, which runs each unit of work inside a Hibernate transaction using
SharedSessionContract.doWork(org.hibernate.jdbc.Work). No entity is ever persisted through
the Session, so the runtime scanner is not re-triggered and there is no risk of recursion.
- Since:
- 2.14.0
- Author:
- Vlad Mihalcea
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongInsert a run (a bootstrap snapshot) and its associated configuration and mapping events, using a single batched statement for the events.voidinsertRuntimeRollups(Collection<RuntimeRollup> rollups) Insert the aggregated runtime rollups using a batched statement.
-
Constructor Details
-
EventStore
-
-
Method Details
-
insertRun
Insert a run (a bootstrap snapshot) and its associated configuration and mapping events, using a single batched statement for the events. The runtime rollups inserted afterward reference this run.- Parameters:
hibernateVersion- the current Hibernate versionbootstrapEvents- the configuration and mapping events collected during scanning- Returns:
- the generated run identifier
- Throws:
SQLException- if a database access error occurs
-
insertRuntimeRollups
Insert the aggregated runtime rollups using a batched statement. The rollups reference the run inserted byinsertRun(java.lang.String, java.util.List<io.hypersistence.optimizer.core.event.Event>), or have aNULLrun_idif there is none.- Parameters:
rollups- the rollups to persist- Throws:
SQLException- if a database access error occurs
-