1. 程式人生 > >Spring Data Neo4j reference文件中關於@RelatedTo註解的注意事項

Spring Data Neo4j reference文件中關於@RelatedTo註解的注意事項

源於3.2.2的reference文件 22.5.5.基於結束節點(end node)區分關係

22.5.5. Discriminating Relationships Based On End Node Type

...

Example 61. Discriminating Relationship Types Using End Node Type

@NodeEntity
class Person {
    @RelatedTo(type="OWNS", enforceTargetType=true)
    Car car;

    @RelatedTo(type="OWNS", enforceTargetType=true)
    Pet pet;
...

The example easily generalises to collections too of course, but there are a few note-worthy rules and corner cases:

  • You need to annotate all clashing relationships.

  • You can’t have two fields, two collections, or a field and a collection, with the same relationship type and identical end node types. SDN does not store metadata about the origin of a relationship. So when saving the entity, the first field or collection would be overwritten by the second, with the processing order being non-deterministic.

  • You can have clashing relation ship types when end nodes share a supertype.

  • A variation on the above, you cannot have two fields or two collections with the same relationship type and substitutable end node types.

  • You can however have a field and a collection where end node types inherit from each other.

  • 你需要註解所有衝突的關係

  • 不可有兩個欄位、集合或一欄位一集合,有同樣的關係型別及同樣的結束節點(end node)型別。

  • 節點型別之間可以有共同基類

  • 兩個欄位、集合有同樣的關係時,節點型別之間不可為可替代的(i.e.互不為繼承關係)

  • 然而,一欄位一集合時節點型別為繼承關係



相關推薦

Spring Data Neo4j reference關於@RelatedTo註解注意事項

源於3.2.2的reference文件 22.5.5.基於結束節點(end node)區分關係 22.5.5. Discriminating Relationships Based On End Node Type ... Example 61. Discrimin

通過Spring配置bean的property賦值

pla 綁定 cli 原因 對象賦值 art contex start nbsp 基本數據類型賦值-通過spring配置文件中bean中的property 擴展-以此方式可以通過配置為連接數據的屬性賦值 1、如果是基本數據類型,可以通過setter方法為對象中的屬性設置初始

maven項目Spring整合Shiro配置(示例)

-a filter service 管理 .org true 緩存 cti text <?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/sc

把 /data 目錄及其子目錄下所有以擴展名 .txt 結尾的包含 magedu 的字符串全部

shellfind /data $PWD | xargs ls -ld |awk '{print $NF}'|grep .txt$|grep magedu |awk -F'magedu' '{print "mv "$1"magedu&qu

Spring獲取properties的屬性

https lac 整理 rop spring配置 bar BE adp snippet 1.前言 本文主要是對這兩篇blog的整理,感謝作者的分享 Spring使用程序方式讀取properties文件 Spring通過@Value註解註入屬性的幾種方式 2.配

Spring 項目把 SQL 語句寫在 .sql

Spring我們在使用 JDBC 時, 如果把所有的 SQL 語句全寫在 Java 文件中, 由於 Java 不支持 Here Document, 多行字符串要麽用加號, 要麽用 Java 8 的 String.join() 方法來連接, 同時不能對 SQL 語句進行語法加亮, 所以這樣的 SQL 字符串閱讀

PHP以multipart/form-data上傳

Curl multipart/form-data 上傳類 class UploadPart { protected static $url; protected static $delimiter; protected static $instance; pub

spring boot配置 spring.mvc.static-path-pattern 配置項

div AD 路由 add hand 源文件 PE 前綴 ML spring boot項目中的靜態資源文件存放在static文件下面,當通過瀏覽器訪問這些靜態文件時,發現必須要添加static作為前綴才能訪問,折騰了一番後發現,這個前綴跟 spring.mvc.static

Spring配置的parent與abstract

handlers dex express 消費 con erp 生成 app num 在看項目的Spring配置文件時,發現消息隊列的配置采用了繼承方式配置Bean,在這梳理總結一下。 其實在基於spring框架開發的項目中,如果有多個bean都是一個類的實例,如配置多

spring配置util:properties和context:property-placeholder

tty general sch rop druid ner com comm int util:properties和context:property-placeholder標簽都可以用來獲取外部配置文件中的內容 1、util:properties 它是以聲明bean方式來

spring16-----XML命名空間和Spring配置的頭

域名 在一起 驗證 length handler 說明 兩個文件 pan copy 一. 什麽是命名空間 在 XML 中,元素名稱是由開發者定義的,當兩個不同的文檔使用相同的元素名時,就會發生命名沖突。類似package的作用。 這個 XML 文檔攜帶著某個表格中的信息:

統計字符串在出現的次數

shell統計a出現的次數[[email protected]/* */ ~]# cat aa.txtsdkasdasasdkasdaajdksaaksldjkalsdaskdlaskdasdjjaskjdasdaskdasdkaslkdasdkalskdjaskdljalskdkalsjdkla

刪除PDF水印的方法

我們經常從網上下載資料,而且多數的pdf文件中都是帶有水印的。那麽為了方便閱讀,想要將pdf文件中的水印刪除,應該怎樣操作呢?接下來小編就教大家一鍵刪除pdf文件水印的方法。 1、如果我們想要刪除pdf文件中的水印,必須要先下載一個pdf編輯軟件。 2、找到相關軟件

使用SharedPreferences將姓名和年齡信息保存在,並讀取信息

new sta text str @override this ket make and 第一個是XML文件: 1 <?xml version="1.0" encoding="utf-8"?> 2 <LinearLayout xmlns:androi

logrotate切割日誌後,新的日誌還是寫入到老的日誌

logrotate線上生產環境中,安裝了dnsmasq,並記錄日誌。由於每一次dns查詢都會生產日誌,考慮到日誌量越來越大,就用logrotate做日誌輪轉。配置如下:/var/log/dnsmasq/dnsmasq.log { daily //按天輪轉日誌 rotat

如何讓vue的代碼在Sublime Text 3中高亮和智能提示

sta sublime light 彩色 沒有 智能提示 tex syn package 大家寫在Sublime Text 3中編寫vue文件時,會發現沒有代碼智能提示,清一色的黑底白字,不會像html、js一樣變成彩色,給我們帶來了很大的不便。所以需要安裝一款叫作Vue

java後臺讀取配置key與value -----demo

undle ltm string 文件名 logs 配置 rip conf 返回值 public class ResourcesUtils { /* * @description:根據屬性獲取文件名 * * @param:propertyName文件的

linux-統計相同行的數量

bsp linux tro nbsp strong images src 統計文件 png cat sorttest | sort | uniq -c sorttest文件內容如下 linux-統計文件中相同行的數量

js讀取本地txt的json數據

input option cti nbsp code tails span details logs list.txt內容 [ {"optionKey":"1", "optionValue":"Canon in D"}, {"optionKey":"2", "op

fastaDNA to RNA

class read odin tcc clas pat red pla tag 同樣的名為read_1.fa 的fasta文件,裏面有若幹序列,如: >@r1TGAATGCGAACTCCGGGACGCTCAGTAATGTGACGATAGCTGAAAACTGTACGA