簡體   English   中英

創建 Neo4j 存儲庫時出錯:“模式已包含主標簽下的節點描述”

[英]Error creating Neo4j repository: "The schema already contains a node description under the primary label"

該項目包含以下文件。

MyGoogleCalendarNeo4jRepository.java:

import org.springframework.data.repository.CrudRepository;

public interface MyGoogleCalendarNeo4jRepository extends CrudRepository<MyGoogleCalendar, String> {}

MyGoogleCalendar.java:

import org.springframework.data.neo4j.core.schema.Id;
import org.springframework.data.neo4j.core.schema.Relationship;

public class GoogleCalendarCalendar {

    @Relationship(type = "ASSOCIATED_TO", direction = Relationship.Direction.OUTGOING)
    private Calendar calendar;
    @Id
    private String id;

    /*
     * Default getters and setters
     */
    ...
 }

日歷.java:

import org.springframework.data.neo4j.core.schema.Id;

public class Calendar {

    @Id
    private String id;
    private com.google.api.services.calendar.Calendar service;

    /*
     * Default getters and setters
     */
    ...
 }

當我嘗試運行該項目時,出現以下錯誤:

org.springframework.beans.factory.UnsatisfiedDependencyException:創建名稱為 [...] 的 bean 時出錯嵌套異常是 org.springframework.beans.factory.BeanCreationException:在 com 中定義的名稱為“myGoogleCalendarNeo4jRepository”的 bean 創建時出錯。[...] .MyGoogleCalendarNeo4jRepository 在 MyApplication 上聲明的 @EnableNeo4jRepositories 中定義:調用 init 方法失敗; 嵌套異常是 org.springframework.data.mapping.MappingException:架構已經包含主 label 日歷下的節點描述

  • 選項 1:更改項目名稱 class。

例如:從日歷MyCalendar

  • 選項 2:將 Google 日歷屬性設為瞬態。

日歷.java:

import org.springframework.data.annotation.Transient;
import org.springframework.data.neo4j.core.schema.Id;

public class Calendar {

    @Id
    private String id;
    @Transient
    private com.google.api.services.calendar.Calendar service;

    /*
     * Default getters and setters
     */
    ...
 }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM