根据此处检索到的示例代码:http ://projects.spring.io/spring-data-neo4j/
可以使用以下代码创建节点实体:
@NodeEntity
public class Movie {
@Id @GeneratedValue Long id;
String title;
Person director;
@Relationship(type="ACTS_IN", direction = Relationship.INCOMING)
Set<Person> actors;
@Relationship(type = "RATED")
List<Rating> ratings;
}
请注意 id 属性上的 @Id 和 @GeneratedValue 注释。
据我了解,@Id 将属性 id 指定为主键,@GenerateValue 导致在创建时生成此值(默认为增量 id 生成)。
在早期版本的 SDN 中,建议不要使用内部 Neo4j id,因为它们是偏移量,因此可能会被回收。
我的问题是,对于 SDN 5.0.2.RELEASE,是否确认现在使用 @Id @GeneratedValue 可以保证 id 是唯一的并且不会被回收?
谢谢