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