Fix IN
/NOT IN
expression handling and support enums when matching on to-many-collections
#11895
+378
−164
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.
This fixes that using a
Criteria
with anIN
orNIN
expression on a many-to-many collection currently leads to an SQL error (#6173). TheManyToMany
persister needs to know about the slightly different SQL syntax for[NOT] IN ()
.In the case of
[NOT] IN
expressions, the value will be an array, which also required me to change (fix?) the parameter type handling. I have pulled the necessary code from theBasicEntityPersister
and placed it as static helper methods inPersisterHelper
.This is somewhat inspired by #11516, which aims at fixing #11481: By re-using the parameter type handling code, it also fixes using backed enums in
EQ
,IN
andNIN
expressions withinCriteria
whenmatching()
on one-to-many and many-to-many collections.Fixes #6173, fixes #11031, fixes #11481, closes #11516.