Skip to content
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

DATAJPA-433 - added workaround to allow parameterized IN with eclipselink #185

Closed
wants to merge 3 commits into from

Conversation

Mobe91
Copy link
Contributor

@Mobe91 Mobe91 commented Nov 28, 2016

This workaround changes calls to

javax.persistence.criteria.Expression#in(javax.persistence.criteria.Expression<?>...)

to calls to

javax.persistence.criteria.Expression#in(javax.persistence.criteria.Expression<java.util.Collection<?>>)

by adding the required casts.

Eclipselink is missing some logic in javax.persistence.criteria.Expression#in(javax.persistence.criteria.Expression<?>...) to handle single collection valued parameters.

Note: This pull request breaks IN with empty collection parameter values for eclipselink which seems to have been working accidentally before. While eclipselink users have not been able to use parameterized IN at all before this fix, they can now use parameterized IN at least with non-empty collection parameter values.

To make parameterized IN work with empty collections, a fix in eclipselink's sql generation is required. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=349477.

schauder pushed a commit that referenced this pull request Jul 4, 2019
…Link.

We now convert parameter to collections and use
`ParameterExpression<Collection<?>>` to declare the parameter.
This utilises the fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=349477.

It does break empty collections in EclipseLink which so far worked in 2.6
but didn't work 2.7 but support for only empty collection isn't of much use.

Original pull request: #185.
schauder added a commit that referenced this pull request Jul 4, 2019
Extracted conversion of iterable into a method and added a shortcut for the likely case that we already have a collection.

Original pull request: #185.
schauder pushed a commit that referenced this pull request Jul 4, 2019
…Link.

We now convert parameter to collections and use
`ParameterExpression<Collection<?>>` to declare the parameter.
This utilises the fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=349477.

It does break empty collections in EclipseLink which so far worked in 2.6
but didn't work 2.7 but support for only empty collection isn't of much use.

Original pull request: #185.
schauder added a commit that referenced this pull request Jul 4, 2019
Extracted conversion of iterable into a method and added a shortcut for the likely case that we already have a collection.

Original pull request: #185.
@schauder
Copy link
Contributor

schauder commented Jul 4, 2019

That is merged and polished.

Thank you.

@schauder schauder closed this Jul 4, 2019
@schauder
Copy link
Contributor

schauder commented Jul 4, 2019

@Mobe91 I tried and failed to create a simple reproducer in order to create a new issue with EclipseLink so they can fix the problems on their side.

I wonder if you could provide a reproducer, possible as a PR to this repo: https://github.com/schauder/issue-eclipselink-in-collection

stsypanov pushed a commit to stsypanov/spring-data-jpa that referenced this pull request Dec 13, 2019
…Link.

We now convert parameter to collections and use
`ParameterExpression<Collection<?>>` to declare the parameter.
This utilises the fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=349477.

It does break empty collections in EclipseLink which so far worked in 2.6
but didn't work 2.7 but support for only empty collection isn't of much use.

Original pull request: spring-projects#185.
stsypanov pushed a commit to stsypanov/spring-data-jpa that referenced this pull request Dec 13, 2019
Extracted conversion of iterable into a method and added a shortcut for the likely case that we already have a collection.

Original pull request: spring-projects#185.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants