Migration to RX

I started the process of switching over to spring data neo4j rx. Right away, I noticed quite a few hurdles that we will need to overcome.

For starters, the missing support of @RelationshipEntity, @StartNode, @EndNode, @Index, @DateLong

We use RelationshipEntity a lot in our project, We have many relationship classes with @StartNode and @EndNode, and it is important to us to know which way the relationship -> points

Are there any suggestions as to how we can migrate. Here's an example of what I'm referring to:

@EqualsAndHashCode(exclude = {"startRoute", "endRoute"}, callSuper = false)
@ToString(exclude = {"startRoute", "endRoute"})
//@CompositeIndex(value = {"Route_ID", "Capture_Id"}, unique = true)

@RelationshipEntity(type = "CARRIED_BY")
public class CarriedBy {
    @Id @GeneratedValue
    private Long graphId;

    @Property(name = "Route_ID")
    private String id;

    @Property(name = "Route_IsAEnd")
    private boolean aEndRouteId;

    @Property(name = "Date_NetworkExtract")
    private Date networkExtract;

    @Property(name = "Capture_Id")
    private Long captureId;

    private RouteEntity startRoute;

    private RouteEntity endRoute;


With the SDN 6.0 RC1 that has been released last Wednesday, there is a new API for mapping relationships with properties.

public class CarriedBy {

  private String id

// other properties

   private RouteEntity endRoute;

and in your RouteEntity something like:

private List<CarriedBy> carriedByRouteEntities;

will make SDN use those relationship properties classes.

For the raw conversion, you would need to define your own converter as described here: Spring Data Neo4j⚡️RX

Note: We are currently updating the documentation and examples for the new relationship properties and moving all to the official Spring Data reference docs.

Thank you Gerrit.

Another snag in the migration we run into is this. We use converters for embedded objects as shown below:

    private RouteState routeState; 

And we wrote our own converters to go to/from the graph:

public class RouteStateConverter implements CompositeAttributeConverter<RouteState> {

    public Map<String, ?> toGraphProperties(RouteState routeState) {
        // conversion code

    public RouteState toEntityAttribute(Map<String, ?> map) {
       // conversion code

I hope that somebody already reached out to you on a different channel but for having a documented answer here: Add support for OGM's CompositeAttributeConverter. [DATAGRAPH-1393] · Issue #1954 · spring-projects/spring-data-neo4j · GitHub
We are working on this.

1 Like

Gerrit do you know when is going to be release?

It has already been released with SDN 6.0.0. To get some impression how it works and should be used I suggest to look into this test class spring-data-neo4j/ImperativeCompositePropertiesIT.java at main · spring-projects/spring-data-neo4j · GitHub