arextest / arextest/arex-agent-java

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

Open
#471 0 comments 0 reactions 1 assignee Claimed by @lucas-myx View on GitHub
bug :lady_beetle:
Dominant language
Java
Stars
564
Forks
140
Avg merge
36m
Merged PRs (30d)
2

Description

### Search before asking

- [X] I have searched the existing [issues](https://github.com/arextest/arex-agent-java/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!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.