Spring Data、Neo4j、Jackson を使用して JSON API を提供しています。次のような単純な User クラスがあります。
@NodeEntity
@JsonAutoDetect(JsonMethod.NONE)
public class User {
@GraphId Long internalId;
@Indexed String id;
public User() {}
public User(String id) {
this.id = id;
}
@JsonProperty
public String getId() {
return this.id;
}
}
URLで属性@Indexed
を使用しています。このフィールドを一意id
に設定する可能性はありますか? (RDBMS のように)
これで、同じ ID を持つ多くのユーザーを作成できます。
Neo4jTemplate template;
...
template.save(new User("testid"));
template.save(new User("testid"));
2 番目に例外を設定するsave
か、少なくとも DB の最初のユーザーを置き換えたいと考えています。
ありがとうございました。