Spring boot Neo4j⚡️RX dto projection with relationship not working

I am trying to use DTO projection, to get only selected relation by the DTO to optimize Neo4j query.

It works fine with normal fields but when I try to get insight relationship with the projected fields, it returns null.

This is my Node entity


@Node("Subscription")
data class Subscription(
        @Id
        val id: UUID,
        @Relationship(type = "TO_PLAN", direction = OUTGOING)
        val plan: SubscriptionPlan?,
        @Relationship(type = "HAS_INVOICE", direction = OUTGOING)
        val invoice: Invoice?,
        @Relationship(type = "HAS_INSIGHT", direction = OUTGOING)
        val insight: Map<Insight, SubscriptionInsightsRelationship>,
        val status: SubscriptionStatuses,
        val isAutoRenewal: Boolean,
        val insightsLastChange: LocalDateTime?,
        @CreatedDate
        val createdDate: LocalDateTime?,
        @LastModifiedDate
        val lastModifiedDate: LocalDateTime?
)

The Map is how to set rich relationship in Neo4j⚡️RX

This is my projection DTO

data class RetrieveSubscriptionDto(
        val id: UUID,
        val insight: Map<Insight, SubscriptionInsightsRelationship>?,
        val status: SubscriptionStatuses,
        val lastModifiedDate: LocalDateTime?
)

This is the repository

interface SubscriptionRepository : ReactiveNeo4jRepository<Subscription, UUID> {
    fun findAllByIdIsNotNull(): Flux<RetrieveSubscriptionDto>
}

The returned value with this projection is

   {
        "id": "d3a816e5-d0be-4721-b34d-346b011b9757",
        "insight": null,
        "status": "ACTIVE",
        "lastModifiedDate": "2020-10-18T01:29:40.37691"
    }

We recently improved the behaviour of DTO projections: DATAGRAPH-1400 - Use the correct domain type before creating DTO proj… · spring-projects/spring-data-neo4j@b85a5be · GitHub
This is no part of the Spring Data Neo4j RC 2 that you can get in a Spring Boot application version 2.4.0-M4.

Some nodes:

  1. SDN/RX is now the official Spring Data Neo4j 6 that will get released on Wednesday (28.10).

  2. The relationship mapping has also changed for relationship properties to be now like:

val insight: List<SubscriptionInsightsRelationship>

and within the @RelationshipProperties class there should be a @TargetNode val insight:Insight to point to the correct target entity.

If i want to try I should go with spring boot 2.4.0-M4 and spring neo4j data dependency 6.0.0RC 2?

Sorry for the delayed answer.

As of this writing you can use the Spring Boot 2.4.0-RC1 that already includes the GA version of SDN 6.0.