Java Spring data aerospike无法将字段设置为空

Java Spring data aerospike无法将字段设置为空,java,spring-data,repository-pattern,aerospike,Java,Spring Data,Repository Pattern,Aerospike,假设您有一个文档: @Document(collection = "person-document", touchOnRead = true) public class PersonDocument { @Id long id; @Field String transaction; } 这就是创建实体的方式: PersonDocument person = new PersonDocument(1L, "112e-dfsc-3442-cwce-3434");

假设您有一个文档:

@Document(collection = "person-document", touchOnRead = true)
public class PersonDocument {

    @Id
    long id;

    @Field
    String transaction;
}
这就是创建实体的方式:

PersonDocument person = new PersonDocument(1L, "112e-dfsc-3442-cwce-3434");
repository.save(person);
PersonDocument person = repository.findOne(1L);
person.setTransaction(null);
repository.save(person);
这就是您试图更新实体的方式:

PersonDocument person = new PersonDocument(1L, "112e-dfsc-3442-cwce-3434");
repository.save(person);
PersonDocument person = repository.findOne(1L);
person.setTransaction(null);
repository.save(person);
但是,后者不会删除“transaction”的bin值,数据存储中仍然存在值“112e-dfsc-3442-cwce-3434”

解决方法是使用空字符串更新值,但是考虑到spring数据的其他实现(特别是spring数据jpa)的工作方式,这有点令人困惑


如果实体字段设置为
NULL
而不是保留旧值,那么删除bin值不是更好吗?因为现在<代码> null <代码>属性在更新过程中被丢弃。请考虑使用最新版本

。 这不应该是个问题,我刚刚检查了场景是否正常工作。 如果您仍然看到问题,请打开问题单并提供测试用例