Skip to content

Relationships are not mappend if defined in abstract class constructor. #2452

Closed

Description

@meistermeier

This is related to the already solved #2418

A relationship in will not get mapped if it is defined in an abstract class and queried through a repository defined for the abstract class.

Example:

abstract class AbstractClass {
@Relationship
public Something something;
}

and

class ConcreteClass extends AbstractClass {
}

with a repository

interface AbstractClassRepository extends Neo4jRepository<AbstractClass,...>

Will create a query containing AbstractClass_SOMETHING_something for the relationship.
On the mapping side, the code already figured out that the class to create an instance from is ConcreteClass and it will look for a ConcreteClass_SOMETHING_something defined property containing the relationship results.

In conclusion the mapping part should always check if there might be an entry for the more abstract type(s) above in the result list.

Activity

  1. self-assigned this
    on Nov 25, 2021
  2. meistermeier commented on Nov 30, 2021

    @meistermeier
    CollaboratorAuthor

    Additional information: This bit is only missing when using relationships in the constructor. #2418 already solved the property (Setter/Wither) problem.

  3. added 2 commits that reference this issue on Nov 30, 2021
  4. added this to the 6.2.1 (2021.1.1) milestone on Dec 2, 2021
  5. changed the title [-]Relationships are not mappend if defined in abstract class.[/-] [+]Relationships are not mappend if defined in abstract class constructor.[/+] on Dec 2, 2021
  6. added a commit that references this issue on Dec 2, 2021
  7. added a commit that references this issue on Aug 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions