-
Notifications
You must be signed in to change notification settings - Fork 682
1.9.x - PropertyPath is not dealing with properties containing underscore #126
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
Removed misleading JavaDoc. Original pull request: #97.
… documentation. Added section explaining the use of first / top keywords to the reference doc. Original pull request: #99.
…the same. DomainClassConverter now returns input when the source type is identical to the target type. Previously we erroneously tried to convert the sourceType to the idType of the targetType's backing repository. As a side effect we also avoid performing some unnecessary converter hops. Original pull request: #101.
…eTypeInformation. So far, the lookup of the type variable map was preferring the type variable maps detected on parent types in nested structures. This caused the concrete type variables in nested types not being considered correctly which caused the type resolution to fall back to the generic bounds. We now accumulate the type variable maps to avoid having to lookup a certain map in the nesting hierarchy. The core fix is in ParentTypeAwareTypeInformation's constructor and mergeMaps(…) respectively. Simplified the handling of type variable maps and made proper use of generics throughout the class hierarchy.
…ected bounds. The initial setup of the type variable map now unfolds the detected types in the map to make sure we detect all type variables present in the current scope. Added caching of component and map value TypeInformation instances to avoid repeated creation.
…nd ResourceLoader everywhere. We now also use the Environment and ResourceLoader for the component scan to detect whether multiple Spring Data modules are on the classpath.
…onfiguration. The bean definitions that were registered for a repository configuration setup we registered once for every usage of the repository configuration element (annotation or XML). This caused multiple registrations of the very same bean definition which - as in case of the RepositoryInterfaceAwareBeanPostProcessor - apparently leads to performance problems in the container startup. Feedback for the latter claim is already asked for but we improved the registration setup nonetheless. Introduced a registerIfNotAlreadyRegistered(…) method on RepositoryConfigurationExtensionSupport to allow easy registration of to-b-registered-once-and-only-once beans. We now hint towards the newly introduced method in registerWithSourceAndGeneratedBeanName(…).
…actorySupport. To be able to verify the conversion of List based query execution results into Sets I extracted a QueryExecutionResultHandler that applies the already implemented handling for Optional types and eventually general prost processing in case the return type declared at the repository query method doesn't match the returned value. Added additional unit tests for Optional handling.
…PostProcessor. Refactored predictBeanType(…) to only look up the predicted cached type once. Related pull request: #108.
…tems given. PageImpl now makes sure that the total given to the constructor is never less than then number of items given to make sure we do not mask broken count calculation by creating an actually invalid instance. Related ticket: DATAMONGO-1120.
…ionDetectionFieldCallback. We now make the field detected by the callback accessible so that the value lookup doesn't fail for private fields. Added a few more unit tests to verify behavior.
We now make sure that all methods detected are made accessible so that clients using them can reflectively invoke them without additional checks.
… for repositories with redeclared CRUD methods. If repository interfaces redeclare CRUD methods we need to use a ReflectionRepositoryInvoker rather than the CRUD one to make sure we pick up the customizations applied to the method declaration (e.g. caching or transaction annotations). This is already fixed in master due to the move to the Spring Data REST RepositoryInvoker API.
Enabled the container based build infrastructure, too, to benefit from resource caching.
We now inspect intermediate path elements to build sort order accordingly. Original pull request: #111.
Simplified implementation of Path conversion. Inlined helper domain types to not to pollute the packages with types that are only used within that very one test class. Original pull request: #111.
…pes of a domain class. In case the repository lookup for a given domain type fails we traverse the given types super-types and try to detect a repository for those. Original pull request: #110.
Simplified type traversal in Repositories.getRepositoryFactoryInfoFor(…) and unit tests. Original pull request: #110.
… PagedResourcesAssembler.
…rMethodArgumentResolver. We now double check the fallback Pageable for being null before trying to lookup the Sort to fall back.
… is used. We now delay the lookup of the setter method until we discover we really need to use property access.
Original pull request: #113.
…tories. The custom factory created to extend all repositories with additional behavior needs to return the type of the custom repository base class from getRepositoryBaseClass(…) to make sure the infrastructure can use it to inspect the CRUD methods correctly. Previously the documentations showed an interface being returned. Code formatting in the example and inline code highlighting.
…f annotations on accessor-only properties. AnnotationBasedPersistentProperty now also caches the absence of properties that are expressed through accessors only. Previously the absence of a field caused us to skip the registration of the absence in the cache.
Removed unused constants. Removed usage of deprecated method in RepositoryBeanDefinitionParser.
…ing JavaConfig. Completed description for the packages-to-scan customization with JavaConfig. Original pull request: #121.
Added a dedicated dependencies.adoc that outlines the usage of the Spring Data release train BOM as well as the way one would customize the release train to be used with Spring Boot. Also, we now explicitly list the Spring Framework version the release requires.
Re-added index and defaulting information to the section that documents the currents state of web pagination. Removed legacy pagination sections as they're not really documenting the very legacy support (that would not even work anymore). Added explicit anchors where missing.
…lookup PropertyDescriptors. Instead of manually using Introspector.getBeanInfo(…) we now use Spring's BeanUtils.getPropertyDescriptors(…) to benefit from some caching of descriptor instances as well as advanced support for fluent setters, default methods etc. Original pull request: #122.
In case the PageableHandlerMethodArgumentResolver was configured to use one-indexed parameters, it wasn't defaulting the lower bounds for the page number. This caused indexes out of the allowed bound submitted causing an invalid index handed tor PageRequest. We now apply better range shifting before the bounds are applied.
…gContext.getPersistentPropertyPath(…). When traversing nested property paths, AbstractMappingContext.getPersistentPropertyPath(…) previously used the raw actual property type. If the property path contains a reference to a generically typed property, this causes the deeper paths not being resolved correctly. We now explicitly use the TypeInformation of the property to retain generics information while traversing the path.
Original pull request: #123.
…rmation. In case we create a ParameterizedTypeInformation for a property we now also analyze the field-local generics information and add the discovered type mappings to the type variable map.
Creating a pull request for this was an accident, right? Id' rather turn this into a request to remove the relevant section from the reference documentation as fixing this basically opens up a can of worms (what about properties with multiple underscores?). We generally recommend following standard Java naming conventions, i.e. not using underscores in variable names. |
There's an open ticket in our bug tracker, which has a few more details on why supporting this would complicate things and why we think it's not worth the effort. |
Right, it was an accident. Sorry for that. Thanks for the ticket hint. In this case can you please remove the corresponding part from the documentation and make it clear to the user why it is not supported. |
I've updated the ticket accordingly. |
Having an entity with an underscore property e.g. "first_name" and a related repository method "findByFirst__name" (as documented with double underscore - http://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.query-methods.query-property-expressions) results in the following exception:
Debugging this behaviour shows that the PropertyPath#from method seems not to deal with this case:
Can you please check this. Thanks in advance!