Skip to content

[BUG] - @Default properties are used in merge statement for h2 and override existing values #956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
belovaf opened this issue Mar 17, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@belovaf
Copy link
Contributor

belovaf commented Mar 17, 2025

Jimmer Version

0.9.64

JDK Version

23

Database

H2

OS

Mac

Expected behavior

merge sql using when matched syntax and updating only s1 property.

Actual behavior

merge sql overrides existing s2 value.

Description

merge should not override existing values with default ones in case of update.

Also jimmer includes all properties in update part of insert on conflict do nothing for postgres, which is unnecessary.

Reproduction steps

sql.save(A {
    name = "new_name"
    s1 = "new_value"
})

Generated SQL

merge into A(NAME, S1, S2) key(NAME) values(?, ?, ?), variables: [new_name, new_value, q2]

Relation Model

@Entity
@KeyUniqueConstraint
interface A : SerialId {
    @Key val name: String
    @Default("q1") val s1: String
    @Default("q2") val s2: String
}

Screenshots

No response

Logs

No response

@belovaf belovaf added the bug Something isn't working label Mar 17, 2025
babyfish-ct added a commit that referenced this issue Mar 18, 2025
@babyfish-ct
Copy link
Owner

Try 0.9.68

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants