-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Align AOT and reflective repository behavior. #5038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… ones. Also fix projection field name mapping error
Make sure to register evaluation context with extension lookup.
builder.addStatement("stages.add(new $T($S, $L))", Document.class, "$sort", | ||
context.localVariable("sortDocument")); | ||
|
||
if (outputType == Document.class || MongoSimpleTypes.HOLDER.isSimpleType(outputType) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MongoRepositoryContributor
uses a MongoMappingContext
. Ideally, we use its SimpleTypeHolder
for further introspection to use a consistent configuration source.
|
||
private static Class<?> getOutputType(MongoQueryMethod queryMethod) { | ||
Class<?> outputType = queryMethod.getReturnedObjectType(); | ||
if (MongoSimpleTypes.HOLDER.isSimpleType(outputType)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use SimpleTypeHolder
from MongoRepositoryContributor
.
@@ -52,7 +53,7 @@ static Placeholder indexed(int position) { | |||
* @param type | |||
* @return | |||
*/ | |||
public static Shape geoJson(int index, String type) { | |||
static Shape geoJson(int index, String type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, I liked to keep public
in package-protected types to indicate a method is intended to be used as sort-of a public API (entrypoint) for other callers outside of the class. In any case, just a thought.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather have them aligned with the type scope in such cases.
@@ -157,12 +179,34 @@ static class PlaceholderParameterAccessor implements MongoParameterAccessor { | |||
|
|||
private final List<Object> placeholders; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, in JPA we've introduced a concept of ParameterBinding
definining BindingIdentifier
(named/indexed identifier within the query) and ParameterOrigin
(Expression, MethodInvocationArgument, Synthetic).
ParameterBinding
can be an In or Like binding to carry around information about post-processing of the binding. I have the impression that MongoDB could benefit from such an arrangement as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently we're missing the link between the parameter and part tree part, so we'd have to introduce that first. I agree that having it would make things easier to follow. Should we do it in a next step?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so. For now, we can use the current approach.
Closes: #5027