Skip to content
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

When the update statement is executed, it is forbidden to modify the … #2238

Closed

Conversation

sunjun041640
Copy link

@sunjun041640 sunjun041640 commented Apr 30, 2021

in mybatis 3.4.x ,

@update(update set name=#{user.name} where id=#{user.id}) void update(UserDO user)

before execute update(UserDO user)
id name
1 A

after execute update(UserDO user)

In application memory,user.id != 1, may be user.id = 2,becase the @update use keyGenerate key, it modify the user.id

@harawata
Copy link
Member

We cannot accept this because it breaks backward compatibility.
And please try harder to provide accurate version/code when explaining the issue so that other developers can reproduce the problem.

There is little/inaccurate information, but if you use PostgreSQL, it might be related to #902.
You should try the latest version (3.5.7 at this point).
If you have to use 3.4.x, try 3.4.6.

@harawata harawata closed this Apr 30, 2021
@sunjun041640
Copy link
Author

sorry, we use the database is mysql, mybatis version is 3.4.5

@harawata
Copy link
Member

harawata commented May 4, 2021

@sunjun041640 ,

I would take a look if you create a small demo project that reproduces the problem and share it on your GitHub repo.
Here are some project templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants