我有以下类层次结构:
class Incident {// Id => Entity
@Id
String id
List<Participant> participants
List<RealEstateProperty> realEstateProperties
}
在哪里
class Participant {// No id => by javers terms - ValueObject
EnclosedContact contact
}
class EnclosedContact {// No id => by javers terms - ValueObject
String name
}
class RealEstateProperty {// No id => by javers terms - ValueObject
List<CadastralSection> cadastralSections
}
class CadastralSection {// No id => by javers terms - ValueObject
String sectionId
}
我已经编写了以下测试(在常规中):
def "Querying Javers Repository for participants changes works correctly"() {
given:
(1..3).each {
javers.commit("author", new Incident(
id: it,
participants: [
new Participant(contact: new EnclosedContact(id: 20 + it))
]
))
}
when:
def snapshots = javers.findSnapshots(QueryBuilder.byValueObjectId(1, Incident.class, "contact").build())
then:
assert snapshots.size() == 1
}
这个测试的结果是:
JaversException: PROPERTY_NOT_FOUND property 'contact' not found in class 'Incident'
试图以这种方式进行更改
def snapshots = javers.findSnapshots(QueryBuilder.byValueObjectId(1, Incident.class, "participants/0/contact").build())
返回空列表。
Javers 是否支持在嵌套的 ValueObjects 上选择更改?