[英]Javers SpringBoot integration QueryBuilder byInstanceId returns empty result
I'm using springboot integration from this example: 我正在从这个例子中使用springboot集成:
https://github.com/l7777777b/organization-structure https://github.com/l7777777b/organization-structure
It's my forked example from: 这是我的分叉示例:
https://github.com/javers/organization-structure https://github.com/javers/organization-structure
using mysql and recent version of Javers 5.6.3, gradle 5.4.1 and springboot 2.1.6.RELEASE. 使用mysql和Javers 5.6.3,gradle 5.4.1和springboot 2.1.6.RELEASE的最新版本。
First im not sure if its an expected behaviour, but the changes and snapshot return empty result when using QueryBuilder.byInstanceId
, but when using QueryBuilder.byClass
it shows correctly. 首先,我不确定它是否是预期的行为,但是使用QueryBuilder.byInstanceId
,更改和快照返回空结果,但是当使用QueryBuilder.byClass
,显示正确。
QueryBuilder.byInstanceId
can show results for newly inserted data, for existing data (data already on database prior the service started) it seems not getting fetched. QueryBuilder.byInstanceId
可以显示新插入的数据的结果,对于现有数据(服务启动之前已经存在于数据库中的数据),似乎没有获取。
To reproduce it: 要重现它:
./gradlew organization-structure-sql:bootRun
像往常一样运行服务./gradlew organization-structure-sql:bootRun
create new person 创建新人
POST http://localhost:8080/view/person { "id": 1, "firstName": "Yang", "lastName": "Huajie", "sex": "MALE", "salary": 22, "position": "DEVELOPER" }
update it, change any property 更新它,更改任何属性
get snapshots using this code: 使用以下代码获取快照:
QueryBuilder jqlQuery = QueryBuilder.byInstanceId("1", Person.class); List<CdoSnapshot> changes = javers.findSnapshots(jqlQuery.build()); JsonConverter jsonConverter = javers.getJsonConverter(); System.out.println(jsonConverter.toJson(changes));
But if i change QueryBuilder.byInstanceId(personId, Person.class);
但是如果我更改QueryBuilder.byInstanceId(personId, Person.class);
into QueryBuilder.byClass(Person.class);
进入QueryBuilder.byClass(Person.class);
i can get all result from database correctly, but i only need to search specific id that's why i need to use byInstanceId
. 我可以从数据库中正确获取所有结果,但是我只需要搜索特定的ID,这就是为什么我需要使用byInstanceId
的原因。
Its look like id is Integer and you are passing a String value to the byInstanceId("1")
, could you please try to change it to int and check ex. 它的ID看起来像是Integer,您正在将一个String值传递给byInstanceId("1")
,请您尝试将其更改为int并检查ex。 byInstanceId(1)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.