arex-agent-java icon indicating copy to clipboard operation
arex-agent-java copied to clipboard

[Bug] hibernate mock 对象持久化状态不正确

Open llkkk opened this issue 9 months ago • 0 comments

Search before asking

  • [X] I have searched the existing issues before asking.

AREX Test Service

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

Current Behavior

代码如下: image

通过 hibernate 查询到的持久化对象,修改属性后最后 save 时执行的应为 update 操作: image

回放时未能正确判断持久化状态,生成的是 insert 语句,匹配不到导致报错: image

Expected Behavior

回放时生成的 sql 应与录制时一致。

Steps To Reproduce

通过 hibernate 查询持久化对象,修改属性后使用 save 方法进行更新,录制和回放生成的 sql 会不一致。

Anything else

关键代码位置: image

addEntity是处理结果集中执行的,但是回放时mock 了整个查询方法,方法内部流程被跳过了 image

image

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!

llkkk avatar May 08 '24 07:05 llkkk