Support generic query type mappings in TypeMapping (fixes #2561) #2562
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.
Type parameters may be declared for
SimpleType
, but in the determination of the query type it is always looked up by raw type.Types may be extended for the support of custom expressions. For example
querydsl-spatial
does this with theGeometryType
:However, due to the limitation described above, extensions are not able to specify specific path implementations for different bounds, or for example pass on the generic bound to the path expression, like:
SomeGenericClass<Integer>
->SomeGenericPath<Integer>
SomeGenericClass<Long>
->SomeGenericPath<Long>
Because the mapping is based on raw class name, the latter will override the previous binding, and
SomeGenericPath<Long>
will be used for both types.Fixes #2561
This feature is useful for implementing custom types. A proof of concept can be seen in my https://github.com/jwgmeligmeyling/hibernate-types-querydsl-apt repository.