Skip to content

Implement built-in SQL create, update and delete - #2

Open
Evolvion wants to merge 1 commit into
mainfrom
feature/create-update-delete
Open

Implement built-in SQL create, update and delete#2
Evolvion wants to merge 1 commit into
mainfrom
feature/create-update-delete

Conversation

@Evolvion

@Evolvion Evolvion commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements connector story #11421.

  • Add default QueryDSL-based create, update, and delete handlers for writable SQL object classes.
  • Preserve explicitly configured Groovy handlers and exclude read-only views from write operations.
  • Support generated, natural, and composite UIDs, including generated composite keys.
  • Execute writes transactionally with rollback and translate common SQL constraint and connection failures to ConnId exceptions.
  • Preserve quoted PostgreSQL identifiers and qualify schema-aware SQL statements.
  • Document create, update-delta, delete, UID, transaction, and error behavior.

Testing

  • mvn package: 250 tests passed, 0 failures, across the full four-module reactor.
  • H2 integration coverage: generated, natural, and composite UIDs; default values; replace/remove deltas; duplicate and validation errors; rollback; unknown UIDs; read-only classes; and custom-handler precedence.
  • PostgreSQL 16 integration coverage: generated keys, composite UIDs, schema-qualified and quoted identifiers, data types, constraints, rollback, and create/update/delete.
  • ConnectorFacade coverage validates generated-key and natural-key CRUD through ConnId.
  • Docker smoke test with midPoint 4.11: connector discovery, resource connection, schema refresh, and shadow create/update/delete succeeded against PostgreSQL and H2. Direct database queries verified each state transition. The H2 JDBC driver was added only to the isolated smoke-test bundle; the production artifact was unchanged.

@tonydamage tonydamage left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase / merge latest masters and integrate your changes into newly introduced Operation Builder hierarchy. See also comments.

return this;
}

/** Registers a built-in handler without replacing an explicitly configured one. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After rebase on latest changes, the operations should be build using sepearate (per operation) SqlObject*BuilderImpl via SqlObjectOperationBuilderImpl
Registration is handled automatically the builder

} else {
var templatesBuilder = new SQLTemplatesRegistry().getBuilder(meta);
templatesFromRegistry = templatesBuilder != null
? templatesBuilder.printSchema().quote().build()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious, why is this needed?

return null;
}

protected Map<Path<?>, Object> createAssignments(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use different name then assignments (may be confusing for midPoint developers / operators) ... my understanding is tht this is column / value pairing right?

handlerBuilder.register(oc, ObjectSearchOperation.class, new SqlSearchOperation(context, def));
handlerBuilder.register(oc, ObjectSyncOperation.class,
new SqlSyncOperation(context, def, SyncConfig.defaultFor(def)));
handlerBuilder.registerIfAbsent(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be necessary after rebase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants