亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Neo4j 的 Spring Date Repository 和“isEmpty”查詢拋出

Neo4j 的 Spring Date Repository 和“isEmpty”查詢拋出

慕森卡 2023-05-24 16:10:00
我在 Neo4j 數據庫中有以下實體:public class CompetencyEntity {    @GeneratedValue(strategy = UuidStrategy.class)    @Id    private String id;    @Property    private String name;    @Relationship(type = "PARENT_OF", direction = Relationship.OUTGOING)    private List<CompetencyEntity> children;    @Relationship(type = "PARENT_OF", direction = Relationship.INCOMING)            private List<CompetencyEntity> parents;    public void setParentOf(CompetencyEntity competency) {        children.add(competency);    }    public void setNotParentOf(CompetencyEntity competency) {        children.removeIf(comp -> comp.id.equals(competency.id));    }}我想查詢數據庫,以便它返回所有沒有定義父項的實體。我想使用@Repository界面自動生成的查詢來完成它。這樣做可以讓我輕松添加@Depth參數。我的存儲庫如下:@Repositorypublic interface CompetencyRepository        extends Neo4jRepository<CompetencyEntity, String>, CrudRepository<CompetencyEntity, String> {    Set<CompetencyEntity> findByNameRegex(String name);    @Query("MATCH (n:CompetencyEntity) WHERE NOT (n)<-[:PARENT_OF]-(:CompetencyEntity) RETURN n")    Set<CompetencyEntity> findRootCompetencies();    @Query("MATCH (n:CompetencyEntity) WHERE NOT (:CompetencyEntity)<-[:PARENT_OF]-(n) RETURN n")    Set<CompetencyEntity> findChildrenCompetencies();    Set<CompetencyEntity> findByChildrenEmpty();    Set<CompetencyEntity> findByParentsEmpty();}查詢findRootCompetencies確實有效。但是當我嘗試findByParentsEmpty()(應該意味著“找到被調用的列表parents為空的實體)方法時,它會拋出以下內容Exception
查看完整描述

1 回答

?
精慕HU

TA貢獻1845條經驗 獲得超8個贊

沒有針對關系的派生查找器方法的內置功能。他們都只關注工作(圖形)屬性。

isEmptyspring Data Neo4j 不支持 special 中的關鍵字。附錄描述了在實現中可能不同的一般 Spring Data 行為。

但是,請查閱特定于商店的文檔以獲取支持的返回類型的確切列表,因為特定商店可能不支持此處列出的某些類型。

查看完整回答
反對 回復 2023-05-24
  • 1 回答
  • 0 關注
  • 130 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號