Skip to content

Condition.not is broken #1945

Closed
Closed
@nkey0

Description

@nkey0

Version 3.2.2.

class NotConditionVisitor extends TypedSubtreeVisitor<NestedCondition> {

should be

class NotConditionVisitor extends TypedSubtreeVisitor<Not> {

https://github.com/spring-projects/spring-data-relational/blob/main/spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/render/NotConditionVisitor.java#L30

Test to reproduce:

    @Test
    public void broken() {
        // when
        Select selectFalse = Select.builder()
                .select(Expressions.just("*"))
                .from("test_table")
                .where(Conditions.just("true").not())
                .build();
        String renderSelectFalse = SqlRenderer.create().render(selectFalse);
        // then - SELECT * FROM test_table
        assertEquals("SELECT * FROM test_table WHERE NOT true", renderSelectFalse)
    }

To be honest, it feels super dangerous.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions