DATAGRAPH-1109 - Add support for persistence constructors for @QueryResults #418
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We support persistence constructors for classes annotated as
@NodeEntity
but not for projections based on DTOS annotated with@QueryResult
.This PR provides persistence constructors for those projections as well, reducing the amount of different programming models a user has to deal with.
The PR is centered around the idea to make
OgmEntityInstantiatorAdapter
a public api asNeo4jOgmEntityInstantiatorAdapter
in the conversion package much as similar concepts in the Mongo store. It also drops the idea ofOgmReflectionEntityInstantiator
being solely an indirection against OGMs 3.1ReflectionEntityInstantiator
. The guard whether the later is available is still applied (inCustomResultConverter
).OgmReflectionEntityInstantiator
becomesQueryResultInstantiator
as dedicated means of instantiating DTOs from a custom result. It either uses theReflectionEntityInstantiator
as before or the new public apiNeo4jOgmEntityInstantiatorAdapter
if applicable.It is applicable if it get hold of the
Neo4jMappingContext
.To pass this around, the
Neo4jRepositoryFactoryBean
andNeo4jRepositoryFactory
have been extended to transport it up to theGraphQueryMethod
, again, much as the Mongo store does.From there on it's accessible in all query related scenarios.