-
Notifications
You must be signed in to change notification settings - Fork 166
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
Cypher types in MapCompositeConverter #630
Comments
Hello Matt, First: When I speak about the Bolt driver, I usually refer to the underlying Neo4j Java Driver (See https://github.com/neo4j/neo4j-java-driver), which is used by Neo4j-OGM-Bolt. Sadly, Neo4j-OGM 3.1 does not. You have some options to workaround: Neo4j-OGM 3.1 with Spring Data LovelaceProvide a custom configuration of OGM and also make the instance of Here is an example: Keypoints are Then, you have to turn of Spring Data Neo4js automatic conversion as well, with some like this https://github.com/michael-simons/bootiful-music/blob/master/knowledge/src/main/java/ac/simons/music/knowledge/support/AbstractAuditableBaseEntity.java#L41-L42 (See While this is a lot of crud around simple things, it is not changeable in OGM 3.1 and SDN Lovelace. The same project (https://github.com/michael-simons/bootiful-music/tree/feature/spatial-native) in Branch OGM 3.2 alpha and SDN MooreThis is done by setting the appropriate Spring Boot property And including our new native type support
The configuration than is as simple as that: There is no Spring Boot property for that. OGM without SDNThis should be possible as well, but here I really recommend going to 3.2. |
Hi, Thanks very much for getting back to me. We're not using Spring here at the moment (the projects are Dropwizard based), so I'm not worried about the Spring data layer.
And I think that due to the Converter having a fixed set of types it knows about: Set<Class> types = new HashSet<>();
types.add(Boolean.class);
types.add(Long.class);
types.add(Double.class);
types.add(String.class);
types.add(List.class);
cypherTypes = Collections.unmodifiableSet(types); Does that seem right? By the way, do you know if there are plans to move 3.2 to beta/release? Or what issues are needed to be resolved before that can happen? Or does it just need some time to bake? Thanks, Matt |
Hi Matt, good catch, the conversion should not be triggered at all in this case. |
Now that I have read your issue a second time, I realize that I gave you an answer to a general problem, not to a specific. Thanks for trying it out nevertheless! I'm only roughly aware that we have this map converter, but giving a quick lock, this should work with the native types enabled as described above
Or, you can add a custom MapConvert (like here When you have time to try this out, a PR against the Master adding a test would be more than appreaciated. A good place would be the submodule If you open a branch, we could work together on it, i.e. you could provide the test with the above workaround in place, we could make sure that the workaround is no longer needed for the next alpha or beta. Looking forward to hear from you, |
Hi, I've created a branch (https://github.com/mattharr/neo4j-ogm), and tried out adding to the tests. Once I got it building locally (it took a few bits and pieces to setup, let me know if you want to chat about them), it looks like just using the allowCast property doesn't work (I wasn't sure it would). The test is in the branch - hopefully I got it right? Cheers, Matt |
Hi Matt, |
Hi, Yes sorry about that, I didn't realise until I'd committed it (my IDE is set up to auto-format on save). Let me know if its too annoying to read through - I can always redo it without the reformat. |
First step:
So that's the reason why setting the parameter has now effect. Your test was already helpful and I've copied it over. |
Second feedback: The That however lead to some fixes and changes for the conversion. Your finding is quite valuable, thank you! I'll try to review the other additions in your code and add them separatly. It would make things easier to keep such suggestions separate from the start for reviewing and merging. Expect a new alpha soon. |
Hi, thanks very much for looking into this, glad it was useful. Sorry about batching everything together - too much time working by myself I think. Cheers, Matt |
It's all good, no harm done. My colleague Gerrit was so kind to release alpha06, with the bug fix and the transformation feature in it. If you find the time, please try it out :) |
Hi, Just to let you know, I pulled the alpha06 version, and it all looks to be working fine now, thanks for getting that sorted. Thanks, Matt |
Thanks for your feedback Matt, much appreciated. |
Expected Behavior
I'm looking at storing dates into the Neo4j database as Dates; specifically in my case I want to store ZonedDateTime, which the Bolt driver will accept (I believe). I've saved the data using Cypher queries (I had to for speed reasons), and so when loading that data back into a Map of data it should load back in.
Current Behavior
This throws an exception saying that ZonedDateTime is not a supported type.
Possible Solution
I took a copy of the MapCompositeConverter and adding ZonedDateTime, and this looked to be OK, but I'm not storing data via OGM, so not sure if this would hit issues?
Your Environment
The text was updated successfully, but these errors were encountered: