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

Upgrade to Neo4j Ogm 3.1.1 #13999

Closed
georgwittberger opened this issue Aug 4, 2018 · 14 comments
Closed

Upgrade to Neo4j Ogm 3.1.1 #13999

georgwittberger opened this issue Aug 4, 2018 · 14 comments
Labels
status: superseded An issue that has been superseded by another

Comments

@georgwittberger
Copy link

I am reporting a bug which occurred when I upgraded my project from Spring Boot version 2.0.3.RELEASE to version 2.0.4.RELEASE.

I am using Spring Data Neo4j in the project and include the spring-boot-starter-data-neo4j dependency.
Since Spring Boot version 2.0.4 the starter seems to provide Spring Data Neo4j version 5.0.9.RELEASE. The POM of Spring Data Neo4j defines the Neo4j OGM version 3.0.4 to be used, see here: https://github.com/spring-projects/spring-data-neo4j/blob/5.0.9.RELEASE/pom.xml
But the BOM of Spring Boot 2.0.4 defines the Neo4j OGM version 3.1.0, see here: https://github.com/spring-projects/spring-boot/blob/v2.0.4.RELEASE/spring-boot-project/spring-boot-dependencies/pom.xml

The really annoying issue here is that this is not only a "formal" mismatch but I encountered a weird runtime error with this new version constellation. When querying a Spring Data repository with a query method like findByUserId(String userId) I suddenly got the following exception:

java.lang.ClassNotFoundException: org.neo4j.ogm.cypher.Filter$NestedPathSegment

Looking into the problem I found out that the inner class NestedPathSegment exists in the Neo4j OGM version up to 3.0.4, see here: https://github.com/neo4j/neo4j-ogm/blob/v3.0.4/core/src/main/java/org/neo4j/ogm/cypher/Filter.java
But then it suddenly disappeared in Neo4j OGM version 3.1.0 which is managed by Spring Boot, see here: https://github.com/neo4j/neo4j-ogm/blob/v3.1.0/core/src/main/java/org/neo4j/ogm/cypher/Filter.java

Perhaps this is the reason why Spring Data Neo4j project did not move to that version so far.

I workaround the issue by overriding the Neo4j OGM version to force usage of 3.0.4 at the moment, to be compliant with Spring Data. I do it in gradle.properties:

neo4j-ogm.version=3.0.4

I am unsure if that issue is correct at your address because also the Neo4j OGM project does not seem to be consistent with their implementation.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 4, 2018
@snicoll
Copy link
Member

snicoll commented Aug 4, 2018

@georgwittberger we've upgraded to Neo4j 3.1.0 way before that (in 2.0.0.RC2 actually, see #12145) so it looks like something has changed in Spring Data Neo4j maybe?

paging @michael-simons for feedback.

@georgwittberger
Copy link
Author

@snicoll Thanks for looking into that so quickly, Stéphane.

I also assume that there was some change in Spring Data Neo4j version 5.0.9 which causes the incompatibility with Neo4j OGM version 3.1.0.

To be more precise how to reproduce: The problem occurs when the query generated by Spring Data has to traverse the object graph for filtering. In my case I query a collection of @RelationshipEntity objects where the property of one related node entity is used for filtering. Image like this:

@RelationshipEntity(type = "RELATED_TO")
class MyRelation {
  @Id
  String id;
  @StartNode
  MyStartNode startNode;
  @EndNode
  MyEndNode endNode;
  String customProperty;
}

@NodeEntity
class MyStartNode {
  @Id
  String id;
  @Relationship(type="RELATED_TO")
  MyRelation relatedTo;
}

@NodeEntity
class MyEndNode {
  @Id
  String id;
  @Relationship(type="RELATED_TO")
  MyRelation relatedTo;
}

@Repository
interface MyRelationRepository extends Neo4jRepository<MyRelation, String> {
  Iterable<MyRelation> findByStartNodeId(String startNodeId);
}

@meistermeier
Copy link
Contributor

We fixed a bug with nested properties in derived finder methods. To keep at least backward compatibility Neo4j OGM introduced an additional API in 3.0.4 and 3.1.1-RC1. These are the versions for Spring Data Neo4j 5.0.9 and 5.1.0-RC1 (Lovelace).
We broke the (API) contract here but unfortunately this was necessary, so it is absolutely our fault. I would suggest keeping Neo4j OGM 3.0.4 for now.
@snicoll As a possible fix we could release a stable 3.1.1 in a few weeks. This could be picked up in the next upgrade, or?

@snicoll
Copy link
Member

snicoll commented Aug 5, 2018

Thanks for the feedback @meistermeier - We can of course upgrade to 3.1.1 for 2.0.5 and 2.1.0.M2. Let's repurpose this issue to that effect.

@snicoll snicoll changed the title Incompatibility of Spring Data Neo4j version and Neo4j OGM version Upgrade to Neo4j Ogm 3.1.1 Aug 5, 2018
@snicoll snicoll added type: dependency-upgrade A dependency upgrade and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 5, 2018
@snicoll snicoll added this to the 2.0.5 milestone Aug 5, 2018
@michael-simons
Copy link
Contributor

Thanks @meistermeier for chiming in and @snicoll for the proposed solution. The fix for nested properties will be in 3.1.1 and 3.0.4, 3.1.1 will be released with SDN Lovelace the latest.
I wonder why OGM is separately managed. Is it for Spring Boot users that want to use OGM but not Spring Data?

@georgwittberger At the moment, we recommend setting the version property as you already did. Sorry for the inconvenience.

michael-simons added a commit to michael-simons/spring-data-examples that referenced this issue Aug 6, 2018
…eries support.

SDN supports derived queries over several, deeply nested properties in the following version combinations:
- Spring Data Kay SR9 + Neo4j-OGM 3.0.4
- Spring Data Lovelace RC1 + Neo4j-OGM 3.1.1

As of writing, Spring Boot 2.0.4 picks up Spring Data Kay SR9 + Neo4j-OGM 3.1.0. This is an unsupported combination, see spring-projects/spring-boot#13999.

This tests asserts the correct versions for Spring Boot 2.1.0+ and 2.0.5+.

Also fixes the use of final field relationships in the domain classes used in the test and removed the usage of deprecated API.
michael-simons added a commit to michael-simons/spring-data-examples that referenced this issue Aug 6, 2018
…eries support.

SDN supports derived queries over several, deeply nested properties in the following version combinations:
- Spring Data Kay SR9 + Neo4j-OGM 3.0.4
- Spring Data Lovelace RC1 + Neo4j-OGM 3.1.1

As of writing, Spring Boot 2.0.4 picks up Spring Data Kay SR9 + Neo4j-OGM 3.1.0. This is an unsupported combination, see spring-projects/spring-boot#13999.

This tests asserts the correct versions for Spring Boot 2.1.0+ and 2.0.5+.

Also fixes the use of final field relationships in the domain classes used in the test and removed the usage of deprecated API.
@snicoll
Copy link
Member

snicoll commented Aug 17, 2018

@meistermeier any update about a 3.1.1 release? We're releasing Tuesday and would like a fix for this issue if possible.

@meistermeier
Copy link
Contributor

meistermeier commented Aug 17, 2018

The Neo4j-OGM 3.1.1 versions is tightly coupled with the Spring Data Lovelace release train. Monday is Spring Data Lovelace RC2 planned and we just released our RC2 yesterday.

Let me chat with the SD team about this. I am thinking about releasing 3.1.1 (final) this weekend because it has no open/known issues. If we would need any changes in OGM for SDN Lovelace GA we could go for a 3.1.2.

Side note: 2.0.5 is not in the calendar. Thought there would be more time for us.

Edit: Thinking about the release this weekend because of this issue not because I want to 😄

@snicoll
Copy link
Member

snicoll commented Aug 17, 2018

@meistermeier we're using 3.1.0 with the Kay release train (as this issue affects Spring Boot 2.0.x). We can't really upgrade to an RC for a maintenance release, that's why I am asking.

If using 3.1.x with Kay is a mistake, please let me know as well (even though I doubt we'll be able to downgrade unless you feel it is seriously wrong). Thanks for the support!

@meistermeier
Copy link
Contributor

That is the root problem you brought to the 2.0.0 release party ;) Kay was only meant to work with Neo4j-OGM 3.0.x but I just saw that there is a Neo4j-OGM version definition in SB when it was too late. So currently we are keeping 3.1.x compatible with Kay (for SB) and Lovelace.
I also have the urge feeling that the version should not get downgraded otherwise I had suggested this in my first comment.

Let me release a stable, non-RC 3.1.1 over the weekend if nobody votes against this.

@michael-simons

This comment has been minimized.

@snicoll
Copy link
Member

snicoll commented Aug 19, 2018

Closing in favour of PR #14132

@snicoll snicoll closed this as completed Aug 19, 2018
@snicoll snicoll added status: duplicate A duplicate of another issue and removed type: dependency-upgrade A dependency upgrade labels Aug 19, 2018
@snicoll snicoll removed this from the 2.0.5 milestone Aug 19, 2018
@philwebb philwebb added status: superseded An issue that has been superseded by another and removed status: duplicate A duplicate of another issue labels Aug 28, 2018
michael-simons added a commit to michael-simons/spring-data-examples that referenced this issue Aug 29, 2018
…eries support.

SDN supports derived queries over several, deeply nested properties in the following version combinations:
- Spring Data Kay SR9 + Neo4j-OGM 3.0.4
- Spring Data Lovelace RC1 + Neo4j-OGM 3.1.1

As of writing, Spring Boot 2.0.4 picks up Spring Data Kay SR9 + Neo4j-OGM 3.1.0. This is an unsupported combination, see spring-projects/spring-boot#13999.

This tests asserts the correct versions for Spring Boot 2.1.0+ and 2.0.5+.

Also fixes the use of final field relationships in the domain classes used in the test and removed the usage of deprecated API.
odrotbohm pushed a commit to spring-projects/spring-data-examples that referenced this issue Aug 31, 2018
SDN supports derived queries over several, deeply nested properties in the following version combinations:
- Spring Data Kay SR9 + Neo4j-OGM 3.0.4
- Spring Data Lovelace RC1 + Neo4j-OGM 3.1.1

As of writing, Spring Boot 2.0.4 picks up Spring Data Kay SR9 + Neo4j-OGM 3.1.0. This is an unsupported combination, see spring-projects/spring-boot#13999.

This tests asserts the correct versions for Spring Boot 2.1.0+ and 2.0.5+. Also fixes the use of final field relationships in the domain classes used in the test and removed the usage of deprecated API.
@dev8500
Copy link

dev8500 commented Dec 7, 2018

I faced this problem today, and I have temporarily moved to 3.1.1. Is there any update on newer versions to have this fix?

@wilkinsona
Copy link
Member

wilkinsona commented Dec 8, 2018

Boot has already upgraded to 3.1.1 and beyond. IIRC, the latest 2.0.x and 2.1.x releases are using 3.1.5.

@georgwittberger
Copy link
Author

@devanshmodi The Spring Boot release 2.0.5 fixed that issue in my case and I was able to remove the OGM version override. Could you please try that version of Spring Boot (or higher)?

ShrikantGit88 pushed a commit to ShrikantGit88/backend-service-pocs that referenced this issue Jun 11, 2022
SDN supports derived queries over several, deeply nested properties in the following version combinations:
- Spring Data Kay SR9 + Neo4j-OGM 3.0.4
- Spring Data Lovelace RC1 + Neo4j-OGM 3.1.1

As of writing, Spring Boot 2.0.4 picks up Spring Data Kay SR9 + Neo4j-OGM 3.1.0. This is an unsupported combination, see spring-projects/spring-boot#13999.

This tests asserts the correct versions for Spring Boot 2.1.0+ and 2.0.5+. Also fixes the use of final field relationships in the domain classes used in the test and removed the usage of deprecated API.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another
Projects
None yet
Development

No branches or pull requests

8 participants