Reputation: 139
Simple example
@Data
@Document("product")
@Accessors(chain = true)
public class Product {
@Id
private String id;
private BigDecimal cost;
}
ArangoDB configuration:
@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());
}
Reading document generate exception:
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
Dependency:
Ok, just forget BigDecimal is mapped to HashMap. Creating queries (biggerThan/lessThan) will be bizarre. I change the data type to Double.
Upvotes: 1
Views: 204
Reputation: 157
You need to define JsonSerializer and JsonDeserializer for class which contains BigDecimal, because ArangoDB do not have support for that type of data. Check this arango serializer documentation: link
Upvotes: 1