You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello everyone, I think we are seeing a regression on saving relationships.
Here an example that works in 7.1.0-M2 and doesn't work in 7.1.0:
@Getter
@Setter
@RequiredArgsConstructor
public class Player {
@Id
private String id;
@Version
private Long version;
private List<TeamMembership> teamMemberships;
private List<ZonedDateTime> birthDates;
}
@Getter
@Setter
@RequiredArgsConstructor
public class Team {
@Id
private String id;
@Version
private Long version;
@Relationship(type = "TEAM_MEMBERSHIPS", direction = Direction.INCOMING)
private List<PlayerMembership> members;
}
@RelationshipProperties
@Data
@AllArgsConstructor
public class PlayerMembership {
@RelationshipId
private Long id;
@TargetNode
private final Player player;
ZonedDateTime start;
ZonedDateTime end;
}
@RelationshipProperties
@Data
@AllArgsConstructor
public class TeamMembership {
@RelationshipId
private Long id;
@TargetNode
private final Team team;
ZonedDateTime start;
ZonedDateTime end;
}
And here the test code that reveals the error:
@Test
public void testWrite_and_get() {
System.out.println("testWrite_and_get");
Player p1 = new Player();
Team t1 = new Team();
p1.setId("p1");
t1.setId("t1");
p1.setTeamMemberships(Arrays.asList(new TeamMembership(null, t1, ZonedDateTime.now(), null)));
playersRepository.save(p1);
Optional<Player> optPlayer = playersRepository.findById("p1");
var actualPlayer = Assertions.assertThat(optPlayer)
.isNotEmpty()
.get();
actualPlayer.extracting("id").asString()
.isEqualTo("p1");
actualPlayer.extracting("teamMemberships").asList()
.hasSize(1); // <---- this fails because teamMembership is empty on database
System.out.println("testWrite_and_get - done");
}
The text was updated successfully, but these errors were encountered:
Thanks for reporting this. This has been fixed in #2728
You can already have it working, if you define
@Configuration
public class SomeConfigurationClass {
/** other configuration things **/
@Bean
public Configuration cypherDslConfiguration() {
return Configuration.newConfig().withDialect(Dialect.NEO4J_5).build();
}
}
in your configuration. Besides making SDN more flexible with the default Cypher-DSL dialect and Neo4j 5, this is also the advice we added to the (upcoming) documentation.
Thanks again for reporting this. I am closing this now and if there is anything else related, feel free to just re-open this issue.
Really glad this matter was already taken care of!
I'm wondering if you'd consider another name for org.neo4j.cypherdsl.core.renderer.Configuration, since it is almost always used in conjunction with Spring's @configuration
Not that important anyway.
Cypher-DSL has nothing to do with Spring (or even Spring Data Neo4j) in first place. It is an independent library that gets used in SDN and has its own set of classes to be used within every Java application.
I can see that the full qualified name to avoid import conflicts is not ideal, but this breaking change within the Cypher-DSL would in the end just be cosmetic. (Also it only occurs if people are using the custom config classes and not throw it directly in their SpringBootApplication)
Hello everyone, I think we are seeing a regression on saving relationships.
Here an example that works in 7.1.0-M2 and doesn't work in 7.1.0:
And here the test code that reveals the error:
The text was updated successfully, but these errors were encountered: