Skip to content

features: execute native statements on a mutation session for transaction hooks#552

Merged
azahnen merged 1 commit into
masterfrom
transaction-lifecycle-hooks
Jun 26, 2026
Merged

features: execute native statements on a mutation session for transaction hooks#552
azahnen merged 1 commit into
masterfrom
transaction-lifecycle-hooks

Conversation

@cportele

Copy link
Copy Markdown
Contributor

Add Session.execute(List) to the FeatureTransactions.Session SPI so callers can run native statements on an open mutation transaction and receive the non-fatal SQL warnings they emit. This backs configurable per-transaction setup and pre-commit hooks in the OGC API transactions building block.

  • FeatureTransactions.Session: new execute(List) default; an empty list is a no-op, otherwise UnsupportedOperationException for providers that cannot run native statements.
  • SqlSession / JdbcSqlSession: run each statement in order and collect the JDBC SQLWarning chain (e.g. PostgreSQL RAISE WARNING / RAISE NOTICE), returning it.
  • On a statement failure throw FeatureMutationHookException, carrying the warnings collected before the failing statement so they survive the rollback path; this is an expected, configuration-driven outcome, not an illegal state.
  • SqlMutationSession delegates to the SQL session.

…tion hooks

Add Session.execute(List<String>) to the FeatureTransactions.Session SPI so
callers can run native statements on an open mutation transaction and receive
the non-fatal SQL warnings they emit. This backs configurable per-transaction
setup and pre-commit hooks in the OGC API transactions building block.

- FeatureTransactions.Session: new execute(List<String>) default; an empty list
  is a no-op, otherwise UnsupportedOperationException for providers that cannot
  run native statements.
- SqlSession / JdbcSqlSession: run each statement in order and collect the JDBC
  SQLWarning chain (e.g. PostgreSQL RAISE WARNING / RAISE NOTICE), returning it.
- On a statement failure throw FeatureMutationHookException, carrying the
  warnings collected before the failing statement so they survive the rollback
  path; this is an expected, configuration-driven outcome, not an illegal state.
- SqlMutationSession delegates to the SQL session.
@azahnen azahnen merged commit 58af2c3 into master Jun 26, 2026
3 checks passed
@azahnen azahnen deleted the transaction-lifecycle-hooks branch June 26, 2026 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants