Closed BenDol closed 3 years ago
@mp911de Do you think this kind of feature request fits into the Spring Data concepts?
Projection interfaces are primarily intended to expose parts of the underlying domain model. Open projections that make use of @Value
build on top of the results and add a bit of sugar. While there is a bit of dynamic in how a property is computed, the actual structure (which properties get exposed) gets defined when the interface is defined.
More dynamic is typically handled by the underlying database (e.g. when using a custom SQL statement to select a certain projection or when using MongoDB's aggregation framework) and not Spring Data itself.
That being said, we'd rather expect Google Datastore to provide such functionality as it doesn't fit into what Spring Data is doing.
Hi @mp911de thanks for the reply! What I'm suggesting here would be the exact same concept as the @Value
projection just in a more dynamic way. I guess I'm not fully understanding why compilation projection fits into Spring Data but creating projection metadata dynamically for the Datastore request, doesn't? Cheers!
EDIT: as far as I understand Spring Cloud GCP Datastore is just using Datastore projection? I could be wrong... https://cloud.google.com/appengine/docs/standard/java/datastore/projectionqueries
@BenDol Spring Cloud GCP Datastore uses projection queries.
You should be able to use datastoreOperations.queryKeysOrEntities(query, entityType)
passing a query of ProjectionEntityQuery
type.
Let us know if that doesn't work for you or if you have any questions.
It would be really helpful for me if there was a way to invoke a projection query at runtime without the need to construct an interface per repository request. Is this currently possible? I haven't seen anything about it.
The ideal solution would be a way to provide all the required projection metadata that you'd generate with the ProjectionFactory, at runtime to generate your query request.
So this would become some sort of builder request with the DatastoreTemplate like:
Obviously there might be missing requirements here, but you get the idea. Something a long these lines would be amazing for us.
Appreciate you taking the time to read through this post!
Regards, Ben