我在春季启动时拥有一个带有嵌入式实体的实体。
现在,当我的嵌入式实体发生更改并且我向我的实体查询更改时,更改不在更改列表中。
@Entity
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TaskEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Embedded
private LockSettingsEmbeddable lockSettings;
}
@Embeddable
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LockSettingsEmbeddable {
private boolean locked;
@Enumerated(EnumType.STRING)
private TaskLock lockSetting;
}
List<Change> changes = javers.findChanges(QueryBuilder.byInstanceId(taskId, TaskEntity.class).build());
List<Change> modifiableList = new ArrayList<>(changes);
modifiableList.sort((o1, o2) -> -1 * o1.getCommitMetadata().get().getCommitDate().compareTo(o2.getCommitMetadata().get().getCommitDate()));
return javers.getJsonConverter().toJson(modifiableList);
答案 0 :(得分:2)
只需启用withChildValueObject
过滤器,请参见
https://javers.org/documentation/jql-examples/#child-value-objects-filter