Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-15-2020 03:05 PM
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:
@NoArgsConstructor
@AllArgsConstructor
@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;
@Index
@Property(name = "Route_ID")
private String id;
@Property(name = "Route_IsAEnd")
private boolean aEndRouteId;
@Property(name = "Date_NetworkExtract")
@DateLong
private Date networkExtract;
@Index
@Property(name = "Capture_Id")
private Long captureId;
@StartNode
private RouteEntity startRoute;
@EndNode
private RouteEntity endRoute;
}
Thanks.
Solved! Go to Solution.
10-01-2020 06:01 AM
I hope that somebody already reached out to you on a different channel but for having a documented answer here: https://jira.spring.io/browse/DATAGRAPH-1393
We are working on this.
09-21-2020 01:51 AM
With the SDN 6.0 RC1 that has been released last Wednesday, there is a new API for mapping relationships with properties.
@RelationshipProperties
public class CarriedBy {
@Property("Route_ID")
private String id
// other properties
@TargetNode
private RouteEntity endRoute;
}
and in your RouteEntity
something like:
@Relationship("CARRIED_BY")
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: https://neo4j.github.io/sdn-rx/current/#conversions
Note: We are currently updating the documentation and examples for the new relationship properties and moving all to the official Spring Data reference docs.
12-21-2020 02:04 PM
Gerrit do you know when is going to be release?
12-22-2020 12:04 AM
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 https://github.com/spring-projects/spring-data-neo4j/blob/master/src/test/java/org/springframework/d...
09-24-2020 12:54 PM
Thank you Gerrit.
Another snag in the migration we run into is this. We use converters for embedded objects as shown below:
@Convert(RouteStateConverter.class)
private RouteState routeState;
And we wrote our own converters to go to/from the graph:
public class RouteStateConverter implements CompositeAttributeConverter<RouteState> {
@Override
public Map<String, ?> toGraphProperties(RouteState routeState) {
// conversion code
}
@Override
public RouteState toEntityAttribute(Map<String, ?> map) {
// conversion code
}
10-01-2020 06:01 AM
I hope that somebody already reached out to you on a different channel but for having a documented answer here: https://jira.spring.io/browse/DATAGRAPH-1393
We are working on this.
All the sessions of the conference are now available online