来自Javers.org
每个Entity实例都有一个名为InstanceId的全局标识符。它由类名和ID值组成。
比较实体引用的策略基于InstanceId,而实体状态是逐个属性的。
实体可以包含ValueObjects,Entity references,Containers,Values和Primitives。
现在我想要两个实体对象,实际上是同一个对象的两个版本,但是Javer会直接判断它们是旧对象和新对象。无法比较它们的价值。
@Entity
public class Person {
@Id
private Integer id;
private String name;
private Integer age;
}
PersonOne(1," Tom",20);
PersonTwo(2," Jerry",18);
有没有办法比较这两个对象?
答案 0 :(得分:2)
您可以告诉JaVers将这些对象比较为ValueObjects(property-by-property):
describe('controller admin parts ->', function() {
var scope, vm, $httpBackend, createController;
beforeEach(module('app'));
beforeEach(inject(function($rootScope, $controller, $injector) {
$httpBackend = $injector.get('$httpBackend');
$httpBackend.when('GET', '/api/getAllNodes').
respond({"responseData": [
{
"n": {
"id": "14",
"data": {
"name": "StageConfig",
"stageArray": "[{\"name\":\"Floor Plan Options\",\"order\":1,\"cardinality\":\"M\",\"description\":\"3\"},{\"name\":\"Community\",\"order\":2,\"cardinality\":\"O\",\"description\":\"1\"},{\"name\":\"Floor Plan\",\"order\":3,\"cardinality\":\"O\",\"description\":\"2\"}]"
}
}
}
]});
scope = $rootScope.$new();
createController = function() {
return $controller('routes', { $scope: scope });
};
}));
afterEach(function () {
$httpBackend.verifyNoOutstandingExpectation();
$httpBackend.verifyNoOutstandingRequest();
});
// tests for stage controller
});