-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Add opt-in support for Neo4j-OGM native types #15637
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
Add opt-in support for Neo4j-OGM native types #15637
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. I had a quick look and added a few questions.
...nfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jProperties.java
Outdated
Show resolved
Hide resolved
...nfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jProperties.java
Outdated
Show resolved
Hide resolved
.../java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jNativeTypesFailureAnalyzer.java
Outdated
Show resolved
Hide resolved
spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
Outdated
Show resolved
Hide resolved
spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
Outdated
Show resolved
Hide resolved
CypherException cypherException = new CypherException("Error executing Cypher", | ||
"Neo.ClientError.Statement.SyntaxError", | ||
"Unable to execute invalid Cypher"); | ||
CypherException cypherException = new CypherException( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I welcome such polish but I'd prefer to see them in a separate commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this resolved really? I can still see the change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Split into two separate commits.
I wanted to have this in one PR, as it is a breaking api change in Neo4j 3.2. Can create two PRs from it as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are seven commits right now so it's hard for me to figure out what is supposed to be squashed and what isn't.
Generally speaking, if you have something that's good to go, I very much prefer a quick PR that I can merge right away. If you don't have time to create one, that's fine as well but please squash the current commits to make that a bit more explicit. Thanks!
I followed your suggestion and replaced the analyzer by some logic throwing an One of the test will fail now as I discovered a bug in our OGM prerelease. So again, thanks for the feedback and ideas. All other suggestions applied. |
@michael-simons can you please squash what needs to be and give us an update about this one? |
This is the version required by SDN 5.2 (Moore) and the one bringing in native types. It requires some adaption to API changes in a test-class.
This includes tests for the autoconfiguration using that new property. The test require the native types for Bolt and embedded in the test scope, so the Neo4j-OGM native types have been added to managed dependencies. The enhanced autoconfiguration throws an InvalidConfigurationPropertyValueException when native types cannot be used due to missing dependencies or wrong transport mode.
I have extracted the version upgrade into #15937 and squashed the remaining commits here. Thanks for your feedback and time on this. |
This includes tests for the autoconfiguration using that new property. The test require the native types for Bolt and embedded in the test scope, so the Neo4j-OGM native types have been added to managed dependencies. The enhanced autoconfiguration throws an InvalidConfigurationPropertyValueException when native types cannot be used due to missing dependencies or wrong transport mode. See spring-projectsgh-15637
Thanks very much for the PR, @michael-simons. I've merged the proposed changes into master along with some polish. The biggest change there was to remove the exception translation. I think there may be some room for improvement in the exception message that could be done in OGM. If we then still want to do something in Boot, I think it would be better to add some dedicated failure analysers. As @snicoll pointed out to me, that would have the advantage of analysing the failure even when the auto-configuration has backed off. |
In the upcoming next release of Neo4j-OGM we provide means to use Neo4j native types (Spatial, Time ec.) in Neo4j-OGM. This native types allow the user to use
java.time.*
and others in entities without OGM converting them to Strings or longs.These types are available for Bolt and Embedded modes and a feature requested by our users.
This PR contains the following:
The dependency of OGM has been set to a released alpha version to be able to discuss this PR.
Neo4j-OGM 3.2 will be the version Spring Data Moore (5.2) requires. It is however not compatible with Spring Data Lovelace (5.1) and as such, this PR should not make it into a Spring Boot version that uses Spring Data Lovelace or before.