Neo4j弹簧数据节点使用字符串作为@id

Neo4j弹簧数据节点使用字符串作为@id,neo4j,spring-data,spring-data-neo4j,Neo4j,Spring Data,Spring Data Neo4j,我正在尝试使用java.lang.String作为节点的@Id @NodeEntity(label = "MachineType") public class MachineType { @Id private String id; .... 根据弹簧数据neo4j docu,应可能: While an id is still required on all entities, the behavior has been simplified by introducin

我正在尝试使用java.lang.String作为节点的@Id

 @NodeEntity(label = "MachineType")
 public class MachineType {
     @Id private String id;
     ....
根据弹簧数据neo4j docu,应可能:

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"
}
这很奇怪,因为字符串实现了序列化。
有人知道下一步在哪里搜索吗?

我认为您不能使用其他任何东西作为ID。请记住,如果删除节点,此长数字将被重复使用

我使用plugin生成真正的唯一键,当我使用springdatarest时,我使用BackendIdConverter将我公开的资源的id更改为uuid

例如: 型号:

@NodeEntity
@资料
公共类目标{
@Id@GeneratedValue Long Id;//aClass){
返回Movie.class.equals(aClass);
}
}
@NodeEntity
@Data
public class Target {

    @Id @GeneratedValue Long id;   // <----Neo4j id 

    private String uuid;           // <----My Key

    @Version Long version;
    private List<String> labels = new ArrayList<>();
    @Relationship(type = "HAS_MEDIA", direction=Relationship.OUTGOING)
    private List<Gallery> media = new ArrayList<>();
@Component 
public class MovieIdConverter implements BackendIdConverter {
    @Autowired MovieRepo movieRepository;

    @Override
    public Serializable fromRequestId(String id, Class<?> entityType) {
        Movie movie = movieRepository.findByUuid(id);
        return  (Serializable) movie.getId();
    }

    @Override
    public String toRequestId(Serializable serializable, Class<?> aClass) {
        Long id = (Long) serializable;
        Optional<Movie> movie = movieRepository.findById(id);
        if (movie.isPresent()) return movie.get().getUuid();
        return null;
}

    @Override
    public boolean supports(Class<?> aClass) {
        return Movie.class.equals(aClass);
    }
}