Skip to content

DeleteOptions.mutate() does not retain the IF condition #1679

Closed

Description

@chuuminggg

DeleteOptions.mutate() does not copy the IF condition. The DeleteOptionsBuilder(DeleteOptions) constructor only copies ifExists:

private DeleteOptionsBuilder(DeleteOptions deleteOptions) {

	super(deleteOptions);

	this.ifExists = deleteOptions.ifExists;
}

UpdateOptionsBuilder(UpdateOptions) copies both ifCondition and ifExists.

Reproducer

DeleteOptions options = DeleteOptions.builder()
		.ifCondition(Criteria.where("version").is(1))
		.build();

DeleteOptions mutated = options.mutate().timeout(Duration.ofSeconds(1)).build();

mutated.getIfCondition(); // null, expected the condition

As a result, changing any other option through mutate() silently turns a conditional (lightweight transaction) delete into an unconditional delete. The existing buildDeleteOptionsMutate test only covers withIfExists(), so it does not catch this.

Affected versions

main, 5.1.x, 5.0.x and 4.5.x contain the same constructor.

I'm happy to submit a pull request.

Activity

  1. added 4 commits that reference this issue on Oct 16, 2026
    6eaacae
    b4695ea
    abdeb8c
    a450025
  2. added a commit that references this issue on Oct 16, 2026
  3. added this to the 5.0.8 (2025.1.8) milestone on Oct 16, 2026
  4. self-assigned this
    on Oct 16, 2026
  5. added a commit that references this issue on Oct 17, 2026
    cddc232
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions