babyfish-ct / jimmer

A revolutionary ORM framework for both java and kotlin.
Apache License 2.0
876 stars 88 forks source link

[bug] Jimmer generates excessive "and not (ID = any(?))" with empty array #726

Closed belovaf closed 1 month ago

belovaf commented 1 month ago

Model:

interface Parent : SerialId {
    @OneToMany(mappedBy = "parent")
    val items: List<Item>
}

interface Item : SerialId {
    @ManyToOne
    @OnDissociate(DissociateAction.DELETE)
    val parent: Parent
}

Code:

sql.update(Parent {
    id = 1
    items = emptyList()
}, AssociatedSaveMode.REPLACE)

Actual Sql:

delete from item where parent_id = ? and not (id = any(?))

Expected Sql:

delete from item where parent_id = ?
babyfish-ct commented 1 month ago

Cannot be fixed