grails / gorm-neo4j

GORM for Neo4j
Apache License 2.0
17 stars 10 forks source link

Support newly added data types in Neo4j #94

Open amadfida opened 6 years ago

amadfida commented 6 years ago

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 commented 6 years ago

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

graemerocher commented 6 years ago

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

jameskleeh commented 6 years ago

@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 commented 6 years ago

@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 commented 5 years ago

@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

amadfida commented 5 years ago

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

jameskleeh commented 5 years ago

@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?