neo4j / neo4j-ogm

Java Object-Graph Mapping Library for Neo4j
https://neo4j.com/docs/ogm-manual/
Apache License 2.0
337 stars 164 forks source link

Add entity instantiation callback mechanism #448

Closed nmervaillie closed 6 years ago

nmervaillie commented 6 years ago

Expected Behavior

OGM should allow to customize entity instantiation to make it possible to use persistence constructors.

nmervaillie commented 6 years ago

This improvement allows to have persistence constructors in Spring Data Neo4j.

Notes about having the same thing with a pure OGM : A pain point is to get parameter names. There is some infrastructure in SDC to get parameter names from class debug information (-parameters compilation args), of if not found by parsing the bytecode and looking at java's LocalVariableTable.

This may not be so easy to do it from scratch and/or probably require adding a dependency. An option could be to enhance FastClasspathScanner to handle it. Maybe we could also use java.beans.ConstructorProperties to handle it. Another thing is kotlin support that require special handling.