Skip to content

Upgrade CypherDSL to 2021.2.4 to fix query generation. #2386

@venkat125

Description

@venkat125

Similar to the following test model:
similar model from Integration Test

Apart from the knows relationship to have another relationship for different label, added

@Relationship(type = "MOTHER_TONGUE_IS", direction = Relationship.Direction.OUTGOING)
    @Property("motherTongue")
    private KnowsMtEntity motherTongue;

@RelationshipProperties
@EqualsAndHashCode(callSuper = true)
@Data
public class KnowsMtEntity extends RBaseEntity {

    @Id
    @GeneratedValue private Long id;

    @TargetNode private Language language;

}

for (p:PERSON)-[:MOTHER_TONGUE_IS]->(l:LANGUAGE))
when i used Repository.findById(id)
I get the motherTongue relationship is being merged to knows relationship array variable in person object on response. But its intermittent. When i made the SDN logs enabled i see the query differs on every execution.
Case 1: Log with wrong response:

MATCH (n:MALE:EXTRA_LABEL_1:EXTRA_LABEL_2) WHERE n.nid = $id RETURN n{.created_on, .d_o_b, .is_active, .mid, .name, .nid, .profession, .updated_on, nodeLabels: labels(n), internalNeo4jId: id(n), MALE_MOTHER_TONGUE_IS_LANGUAGE: [(n)-[MALE__relationship__LANGUAGE:**MOTHER_TONGUE_IS**]->(n_motherTongue:LANGUAGE) | n_motherTongue{.name, nodeLabels: labels(n_motherTongue), internalNeo4jId: id(n_motherTongue), MALE__relationship__LANGUAGE}], MALE_KNOWS_LANGUAGE: [(n)-[MALE__relationship__LANGUAGE]->(n_knows:LANGUAGE) | n_knows{.name, nodeLabels: labels(n_knows), internalNeo4jId: id(n_knows), MALE__relationship__LANGUAGE}]}
2021-09-24 17:40:47.330 DEBUG 13504 --- [p-nio-80-exec-2] o.s.d.n.c.t.Neo4jTransactionManager : Initiating transaction commit
response :{"mid":"21M0002","name":"abcd","profession":"IT","dateOfBirth":"xxxxx","updated":"xxxxxxx","is_active":true,"motherTongue":{"id":67,"language":{"name":"english"}},"knows":[{"id":67,"language":{"name":"english"}},{"id":65,"speak":true,"read":true,"write":true,"language":{"name":"german"}}],"nid":"0507cb3f-f790-11eb-91d7-c90c6f7f0f17|21M0002"}

Case 2: Log with correct response:

MATCH (n:MALE:EXTRA_LABEL_1:EXTRA_LABEL_2) WHERE n.nid = $id RETURN n{.created_on, .d_o_b, .is_active, .mid, .name, .nid, .profession, .updated_on, nodeLabels: labels(n), internalNeo4jId: id(n), MALE_KNOWS_LANGUAGE: [(n)-[MALE__relationship__LANGUAGE:**KNOWS**]->(n_knows:LANGUAGE) | n_knows{.name, nodeLabels: labels(n_knows), internalNeo4jId: id(n_knows), MALE__relationship__LANGUAGE}], MALE_MOTHER_TONGUE_IS_LANGUAGE: [(n)-[MALE__relationship__LANGUAGE]->(n_motherTongue:LANGUAGE) | n_motherTongue{.name, nodeLabels: labels(n_motherTongue), internalNeo4jId: id(n_motherTongue), MALE__relationship__LANGUAGE}]}
2021-09-24 17:41:46.010 DEBUG 8276 --- [p-nio-80-exec-2] o.s.d.n.c.t.Neo4jTransactionManager : Initiating transaction commit
response :{"mid":"21M0002","name":"abcd","profession":"IT","dateOfBirth":"xxxxx","updated":"xxxx","is_active":true,"motherTongue":{"id":67,"language":{"name":"english"}},"knows":[{"id":65,"speak":true,"read":true,"write":true,"language":{"name":"german"}}],"nid":"0507cb3f-f790-11eb-91d7-c90c6f7f0f17|21M0002"}

Even though the label for relationship in the query is not added properly for both the query (case 1:KNOWS) label missing and in (case 2: MOTHER_TONGUE_IS) label missing.
However, the case 2 response is correct.
Note: no code change between two cases. Just stopped and started the application.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions