简单例子
@Data
@Document("product")
@Accessors(chain = true)
public class Product {
@Id
private String id;
private BigDecimal cost;
}ArangoDB配置:
@Override
public Builder arango() {
final Builder builder = new Builder();
arangoDbConfig.getHosts().forEach(host -> builder.host(host.getHost(), host.getPort()));
return builder
.user(arangoDbConfig.getUser())
.password(arangoDbConfig.getPassword())
.registerModule(new VPackJdk8Module());
}读取文档会产生异常:
Invocation of init method failed; nested exception is org.springframework.data.mapping.model.MappingInstantiationException: Failed to instantiate java.math.BigDecimal using constructor NO_CONSTRUCTOR with arguments 受抚养人:
Ok,忘了BigDecimal是映射到HashMap的。创建查询(大于/减will )将是很奇怪的。我将数据类型更改为.。
发布于 2019-03-14 10:26:02
您需要为包含JsonSerializer的类定义BigDecimal和JsonDeserializer,因为ArangoDB不支持该类型的数据。查看以下arango序列化程序文档:链接
https://stackoverflow.com/questions/48469469
复制相似问题