Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassInfo#relationshipFields determines the field infos on each call #849

Closed
torstenkuhnhenne opened this issue Oct 15, 2020 · 1 comment

Comments

@torstenkuhnhenne
Copy link
Contributor

When a relationship is mapped in OGM the method ClassInfo#relationshipFields is called every time. This is not necassary and the Collection<FieldInfo> can be determined once and cached. This is already done for the property fields.

The current implementation causes a not optimal performance:
image-2020-09-10-15-51-51-337

With a cached implementation the method ClassInfo#relationshipFields tends to a zero execution time.

I will try to create a Pull Request that uses as same logic for the relationship fields that is currently in use for the property fields.

Expected Behavior

Cache the field infos for relationship property as for the property fields.

Current Behavior

Field infos for the relationship properties are determined for each mapping.

Context

We are using relationship properties in some of our domain classes and reading those from the database is not as optimal as it could be.

Your Environment

  • Java version: 11
  • Neo4j version (The version of the database): 3.5.22
  • OGM Version (The version of this software): 3.2.17
  • OGM Transport used (One of Bolt, HTTP or embedded): Bolt
  • Neo4j Java Driver version (in case of Bolt transport): 4.1.1
  • Link to your project: ./.

Steps to Reproduce

Use domain classes with @Relationship annotations and do some performance tests reading entities from the database.

torstenkuhnhenne added a commit to torstenkuhnhenne/neo4j-ogm that referenced this issue Oct 15, 2020
Cache the collection of FieldInfos for the relationshop fields as it is already done for the property fields.
torstenkuhnhenne added a commit to torstenkuhnhenne/neo4j-ogm that referenced this issue Oct 15, 2020
Cache the collection of FieldInfos for the relationshop fields as it is already done for the property fields.
michael-simons added a commit that referenced this issue Oct 26, 2020
Cache the collection of FieldInfos for the relationship fields as it is already done for the property fields.

Co-authored-by: Michael Simons <michael.simons@neo4j.com>
michael-simons added a commit that referenced this issue Oct 26, 2020
Cache the collection of FieldInfos for the relationship fields as it is already done for the property fields.

Co-authored-by: Michael Simons <michael.simons@neo4j.com>
@michael-simons
Copy link
Collaborator

Fixed with #850

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants