Issue Details (XML | Word | Printable)

Key: NUCJPA-254
Type: Bug Bug
Status: Closed Closed
Resolution: Duplicate
Priority: No Testcase No Testcase
Assignee: Unassigned
Reporter: Piotr Ostrowski
Votes: 0
Watchers: 1

If you were logged in you would be able to see more operations.
DataNucleus API JPA

Criteria API multiselect not working with Predicates

Created: 13/Nov/13 06:52 PM   Updated: 19/Nov/13 04:37 PM   Resolved: 14/Nov/13 03:52 PM
Component/s: None
Affects Version/s: 3.3.3
Fix Version/s: None

 Description  « Hide
There is a problem with CriteriaQuery.multiselect(...) method. This method takes a list of Selection's as argument.
When list of Selection's is a list of Path's, everythink works as expected:
cq.multiselect(r.get("col1"), r.get("col2"), r.get("col3"));

The problem occurs when to list of Selection's I added some Predicate's. For example:
cq.multiselect(r.get("col1"), r.get("col2"), r.get("col3"), cb.isNotNull(r.get("col4"));

This code throws an 'org.datanucleus.exceptions.NucleusUserException: Query defines a result class "SampleDTO" but there is no way of setting the field "col4"' exception. The same code works correctly with OpenJPA, ObjectDB and BatooJPA.

I have prepared a simple test project for DataNucleus and other JPA implementations (attachment). To execute DataNucleus test, call:
mvn clean test -Pdatanucleus

Sort Order: Ascending order - Click to sort in descending order

Piotr Ostrowski added a comment - 14/Nov/13 08:30 AM

Andy Jefferson added a comment - 14/Nov/13 03:52 PM
Refer to NUCRDBMS-707

Piotr Ostrowski added a comment - 15/Nov/13 08:58 AM
Referred ticked was fixed in 3.2.8 version, but problem with multiselect still exists in newest version.

Piotr Ostrowski added a comment - 15/Nov/13 09:20 AM
I have added another test case on github project. It shows, that problem isn't only with boolean expressions.

For example concat expression is also not working:
cq.multiselect(r.get("id"), cb.concat(r.<String> get("name"), r.<String> get("surname")));

Andy Jefferson added a comment - 17/Nov/13 10:05 AM - edited
Which is unlikely anything to do with this "issue" (which was nothing to do with any Criteria multiselect feature, instead support for returning boolean non-fields in JDOQL/JPQL for RDBMS). If you have some problem you raise it as its own issue.

Piotr Ostrowski added a comment - 19/Nov/13 03:03 PM
I don't know, why you close this issue. I have made a simple test case that newest version of datanucleus failed and some other JPA providers pass correctly. So how this issue can be related to another already fixed issue? And if it is realy related, why is that issue fixed, while the problem still exists?
I have no problem with datanucleus, because i'm not using it. I have done a test with some multiselect features and with many JPA providers. Datanucleus was the worst (Hibernate and EclipseLink also not impressed), so I decided to open this issue, but you thing is nothing to do with it...

Andy Jefferson added a comment - 19/Nov/13 03:10 PM
If you read my comment I said open a separate JIRA issue per "problem"; you want to lump them all into one JIRA issue and that is not how this project works (nor how the majority of open source projects work). The thing you raised this JIRA issue for is fixed in the RDBMS plugin (as you already said yourself, above), and was nothing to do with multiselect of Criteria FWIW. So you should then raise this separate problem in a different JIRA issue. Nowhere above have i said you don't have some separate second problem.

Saying something was the "worst" is pretty lame when you provide no basis for that. If you had provided some independent set of tests that defined compatibility with some API spec then there would be basis for comment, instead we just get "worst". Don't forget, this software is there for free for you to use if you want (and if you don't want to then just don't use it). Obviously I can find many things that are "problems" in other persistence providers that DataNucleus handles very well.

Andy Jefferson added a comment - 19/Nov/13 03:12 PM
Oh, and this is "closed" because 3.3.4 is released (where the RDBMS fix that your original problem is present)

Piotr Ostrowski added a comment - 19/Nov/13 04:32 PM
When I was opened this issue, I attached a simple project witch was testing many persistence providers, but this attachment gone. I said, that datanucleus was worst in that test project. Now I have checked 3.3.4 release and it passes all tests successfully (concat, boolean and more). So now Hibernate is the worst :)

And datanucleus certainly is not the worst. In the same time I have opened similar issues on Hibernate and EclipseLink JIRAs and there are still not any comments or answers...


Andy Jefferson added a comment - 19/Nov/13 04:37 PM
Thanks for the feedback Piotr. We do try to fix problems when reported (not that there is always as much time as we'd like), and thanks for taking the time to report them and check.