【发布时间】:2018-08-30 05:58:42
【问题描述】:
我正在尝试使用 java.lang.String 作为 NodeEntity 的 @Id。
@NodeEntity(label = "MachineType")
public class MachineType {
@Id private String id;
....
根据spring数据neo4j文档应该是可以的:
While an id is still required on all entities, the behavior has been
simplified by introducing the new @Id annotation. It replaces both
@GraphId and the primary attribute and can be placed on any attribute
with a simple type.
当我尝试插入时,我得到一个:
{
"cause": null,
"message": "Id must be assignable to Serializable!: null"
}
这很奇怪,因为 String 实现了 Serializable。 有人知道下一步该去哪里搜索吗?
【问题讨论】:
标签: neo4j spring-data spring-data-neo4j