gorm-neo4j icon indicating copy to clipboard operation
gorm-neo4j copied to clipboard

Support newly added data types in Neo4j

Open amadfida opened this issue 7 years ago • 7 comments

We would like to request some enhancements to neo4j-gorm to support new data types

  1. Java 8 date/time : Currently all dates are stored as long
  2. Geospatial types i.e. Point

More information can be found here : https://neo4j.com/docs/developer-manual/current/drivers/cypher-values/

Let me know if you have any questions.

Thanks

amadfida avatar Aug 26 '18 00:08 amadfida

@jameskleeh can you provide your feedback or if you need more information?

amadfida avatar Aug 29 '18 02:08 amadfida

Should be a matter of updating the https://github.com/grails/gorm-neo4j/blob/master/grails-datastore-gorm-neo4j/src/main/groovy/org/grails/datastore/gorm/neo4j/Neo4jMappingContext.java#L47 list to include the types and potentially adding converters

However some of the types added require Java 8 so this cannot go into 6.1.x and must wait until 7.x which will be Java 8 only

graemerocher avatar Aug 29 '18 06:08 graemerocher

@amadfida It's possible we can support this through the grails-java8 plugin. I'll be looking into what is necessary to get it to work.

jameskleeh avatar Aug 30 '18 16:08 jameskleeh

@amadfida I cannot reproduce your claim that all the dates are stored as long. I have the following types in my domain (per the neo4j docs):

    LocalDate
    OffsetTime
    LocalTime
    ZonedDateTime
    LocalDateTime

Saving an instance produces:

"properties": {
          "a": "2018-09-05",
          "b": "10:22:27.837-04:00",
          "c": "10:22:27.839",
          "d": "2018-09-05T10:22:27.841-04:00[America/New_York]",
          "e": "2018-09-05T10:22:27.843",
          "version": {
            "low": 0,
            "high": 0
          }
        }

When I attempt to read the domain, those properties are null, however they look like they are stored correctly to me. Can you verify?

jameskleeh avatar Sep 05 '18 14:09 jameskleeh

@amadfida Native support for those types was not added until driver version 1.6. Here are things we can do:

  1. Upgrade the neo4j driver to 1.6 in neo4j-gorm 6.2.0 (not released yet).
  2. Register converters with the grails-java8 plugin to allow JSR310 dates to work in the current 6.1.x neo4j-gorm.

I'm not sure we can do anything about the new spatial types in neo4j-gorm 6.1.x since I believe that requires driver support.

Let me know your thoughts

jameskleeh avatar Sep 05 '18 16:09 jameskleeh

@jameskleeh we can target it for neo4j-gorm 6.2.0.

amadfida avatar Sep 05 '18 17:09 amadfida

@amadfida I've updated 6.2.0.BUILD-SNAPSHOT to use the latest driver. Can you test to see if it is working as expected?

jameskleeh avatar Sep 10 '18 19:09 jameskleeh