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

[Bug] hibernate save操作回放失败 #582

Open
1 of 2 tasks
buzz321 opened this issue Nov 6, 2024 · 0 comments
Open
1 of 2 tasks

[Bug] hibernate save操作回放失败 #582

buzz321 opened this issue Nov 6, 2024 · 0 comments
Labels
bug 🐞 Something isn't working

Comments

@buzz321
Copy link

buzz321 commented Nov 6, 2024

Search before asking

  • I have searched the existing issues before asking.

AREX Test Service

AREX Java Agent (arextest/arex-agent-java)

Current Behavior

现象描述:
使用arex对以下hibernate代码进行录制:
MarkLogDO markLogDO = markLogRepo.findByRemark(remark);
markLogDO.setLogFilePath(filePath);
return markLogRepo.save(markLogDO);

录制结果正常(一条query、一条update),当对该条数据进行回放时出现空指针异常
java. lang. NullPointerException: null
at org.hibernate. loader.entity.AbstractEntityLoader. load(AbstractEntityLoader. java: 86)
at org.hibernate. loader.entity.AbstractEntityLoader. load(AbstractEntityLoader. java:63)
at org.hibernate.persister.entity.AbstractEntityPersister.doLoad(AbstractEntityPersister.java:4415)
at org.hibernate.persister.entity.AbstractEntityPersister. load(AbstractEntityPersister. java:4405)

排查过程:
根据hibernate源码显示,在执行save操作时,org.hibernate.event.internal.DefaultMergeEventListener.onMerge()方法会对游离态实体执行select xxx by id做一次状态合并,而录制时实体的状态是持久态,不需要查一次id就没录,因为没有录制 所以回放失败 但是select xxx by id的行为并不是我们自己执行的 而是hibernate内部行为

Expected Behavior

期望hibernate使用方可以不关心接口内部实现做到回放正常

Steps To Reproduce

1

Anything else

No response

Are you willing to submit a pull request to fix on your own?

  • Yes I am willing to submit a pull request on my own!
@buzz321 buzz321 added the bug 🐞 Something isn't working label Nov 6, 2024
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

1 participant