title: How do I return relationship properties (Neo4j + Spring data)?
body: <h1>Project Details</h1>
  <p>I am following along with these docs <a href="https://docs.spring.io/spring-data/neo4j/docs/current/reference/html/#reference" rel="nofollow noreferrer">Spring Data Neo4j</a> using Kotlin and I am struggling to return the relationship from a repository query:</p>
  <p><strong>Database layout</strong></p>
  <p>I have a <code>User</code> node and an <code>Skill</code> node with the following relationship:</p>
  <p><a href="https://i.stack.imgur.com/nIKbw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nIKbw.png" alt="enter image description here" /></a></p>
  <p><strong>Entities</strong></p>
  <p>Skill</p>
  <pre><code>@Node
  data class Skill(
          @Id
          val uid: UUID,
  
          val title: String,
  ) {
  
      constructor(title: String) : this(UidGenerator.makeOne(), title)
  
  }
  </code></pre>
  <p>User</p>
  <pre><code>@Node
  data class User(
          @Id
          var uid: UUID,
  
          @Relationship(type = &quot;DEMONSTRATES&quot;)
          val demonstrates: List&lt;Demonstrates&gt;,
  
          val firstName: String,
          val lastName: String,
  ) {
  
      constructor(demonstrates: List&lt;Demonstrates&gt;, firstName: String, lastName: String)
              : this(UidGenerator.makeOne(), demonstrates, firstName, lastName)
  
  }
  </code></pre>
  <p><strong>Relationship Properties</strong></p>
  <pre><code>@RelationshipProperties
  data class Demonstrates(
          @TargetNode
          val skill: Skill,
  
          val rating: Int,
  )
  </code></pre>
  <h1>The Problem I am having</h1>
  <p>When I inject the following repository and call the <code>getDemonstrationList</code> I am getting the error that follows.</p>
  <pre><code>@Repository
  interface MyRepository : Neo4jRepository&lt;Skill, UUID&gt; {
  
      @Query(&quot;&quot;&quot;
          MATCH (:User)-[d:DEMONSTRATES]-&gt;(:Skill) RETURN d
      &quot;&quot;&quot;)
      fun getDemonstrationList(): List&lt;Demonstrates&gt;
  
  }
  </code></pre>
  <pre><code>Caused by: org.springframework.data.neo4j.core.mapping.NoRootNodeMappingException: Could not find mappable nodes or relationships inside Record&lt;{d: relationship&lt;4&gt;}&gt; for org.springframework.data.neo4j.core.mapping.DefaultNeo4jPersistentEntity@750a04ec
      at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.read(DefaultNeo4jEntityConverter.java:106) ~[spring-data-neo4j-6.0.2.jar:6.0.2]
      at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.read(DefaultNeo4jEntityConverter.java:67) ~[spring-data-neo4j-6.0.2.jar:6.0.2]
      at org.springframework.data.neo4j.core.mapping.Schema.lambda$getRequiredMappingFunctionFor$0(Schema.java:96) ~[spring-data-neo4j-6.0.2.jar:6.0.2]
      at org.springframework.data.neo4j.repository.query.Neo4jQuerySupport.lambda$getMappingFunction$0(Neo4jQuerySupport.java:105) ~[spring-data-neo4j-6.0.2.jar:6.0.2]
      at org.springframework.data.neo4j.core.PreparedQuery$AggregatingMappingFunction.apply(PreparedQuery.java:218) ~[spring-data-neo4j-6.0.2.jar:6.0.2]
      at org.springframework.data.neo4j.core.PreparedQuery$AggregatingMappingFunction.apply(PreparedQuery.java:154) ~[spring-data-neo4j-6.0.2.jar:6.0.2]
      at org.springframework.data.neo4j.core.DelegatingMappingFunctionWithNullCheck.apply(DelegatingMappingFunctionWithNullCheck.java:45) ~[spring-data-neo4j-6.0.2.jar:6.0.2]
      at org.springframework.data.neo4j.core.DelegatingMappingFunctionWithNullCheck.apply(DelegatingMappingFunctionWithNullCheck.java:35) ~[spring-data-neo4j-6.0.2.jar:6.0.2]
      at org.springframework.data.neo4j.core.DefaultNeo4jClient$DefaultRecordFetchSpec.lambda$partialMappingFunction$0(DefaultNeo4jClient.java:325) ~[spring-data-neo4j-6.0.2.jar:6.0.2]
      at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[na:na]
      at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133) ~[na:na]
      at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[na:na]
      at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
      at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
      at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
      at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
      at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[na:na]
      at org.springframework.data.neo4j.core.DefaultNeo4jClient$DefaultRecordFetchSpec.all(DefaultNeo4jClient.java:312) ~[spring-data-neo4j-6.0.2.jar:6.0.2]
      at org.springframework.data.neo4j.core.Neo4jTemplate$DefaultExecutableQuery.getResults(Neo4jTemplate.java:575) ~[spring-data-neo4j-6.0.2.jar:6.0.2]
      at org.springframework.data.neo4j.repository.query.Neo4jQueryExecution$DefaultQueryExecution.execute(Neo4jQueryExecution.java:51) ~[spring-data-neo4j-6.0.2.jar:6.0.2]
      at org.springframework.data.neo4j.repository.query.AbstractNeo4jQuery.execute(AbstractNeo4jQuery.java:85) ~[spring-data-neo4j-6.0.2.jar:6.0.2]
      at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:137) ~[spring-data-commons-2.4.2.jar:2.4.2]
      at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:121) ~[spring-data-commons-2.4.2.jar:2.4.2]
      at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:152) ~[spring-data-commons-2.4.2.jar:2.4.2]
      at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:131) ~[spring-data-commons-2.4.2.jar:2.4.2]
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.2.jar:5.3.2]
      at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:80) ~[spring-data-commons-2.4.2.jar:2.4.2]
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.2.jar:5.3.2]
      at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) ~[spring-tx-5.3.2.jar:5.3.2]
      at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) ~[spring-tx-5.3.2.jar:5.3.2]
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) ~[spring-tx-5.3.2.jar:5.3.2]
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.2.jar:5.3.2]
      at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137) ~[spring-tx-5.3.2.jar:5.3.2]
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.2.jar:5.3.2]
      at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) ~[spring-aop-5.3.2.jar:5.3.2]
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.2.jar:5.3.2]
      at org.springframework.data.repository.core.support.MethodInvocationValidator.invoke(MethodInvocationValidator.java:98) ~[spring-data-commons-2.4.2.jar:2.4.2]
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.2.jar:5.3.2]
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) ~[spring-aop-5.3.2.jar:5.3.2]
      at com.sun.proxy.$Proxy68.getDemonstrationIds(Unknown Source) ~[na:na]
      at com.ntr.neo4j.Neo4jApplication.run(Neo4jApplication.kt:44) ~[classes/:na]
      at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:804) ~[spring-boot-2.4.1.jar:2.4.1]
      ... 5 common frames omitted
  </code></pre>
  <h1>My question</h1>
  <p>I am pretty new to Kotlin and Neo4j but I do understand the Spring framework. From what I understand, the repository is not able to workout that it needs to create a <code>Demonstrates</code> instance list out of the result of my query. I am interested in getting the <code>rating</code> property off the relationship but the tutorial is not really clear on how I can do that. Please let me know what I am missing in order to get my query to return a list of <code>Demonstrates</code>?</p>