While creating the test cases that accompanied the following example in the DeltaSpike Data documentation for Query Option ( here <https://deltaspike.apache.org/documentation/data.html#QueryOptions21> ), we found two issues: The documentation says to use sortAsc and sortDesc, but those methods are no longer in QueryResult. Apparently, you changed the methods to orderAsc and orderDesc but didn’t change the documentation In our sample tests, we changed the APIs to use orderAsc and orderDesc (see below), but then we get the exception below @Testpublic void testFindByLastNameReturningQueryResults() { final String lastName = "Smith"; QueryResult queryResult = personRepository.findByLastNameReturningQueryResult(lastName); List people = queryResult.orderAsc(PersonDE_.firstName).orderDesc(PersonDE_.age).getResultList(); assertTrue(people.size() > 0); final String traceHeading = "last name of " + lastName + " using Named Query with Query Annotation"; this.trace(traceHeading, people);}@Dependent@Repository@EntityManagerConfig(entityManagerResolver = SampleEntityManagerResolver.class)public abstract class PersonRepository extends FJpaBaseEntityRepository<PersonDE, String> implements CriteriaSupport { . . . /** * Query to find a list of People identified by their last name * * @param lastName * the last name * @return List * the list of Person Domain Entity associated with the last name specified */ @Query(value = "select p from PersonDE p where p.lastName like ?1", hints = { @QueryHint(name = "javax.persistence.cache.retrieveMode", value = "BYPASS") }) public abstract QueryResult findByLastNameReturningQueryResult(String lastName);}Exception Thrown when executing fluent query options:-----------------------------------------------------Dec 17, 2015 5:43:04 PM org.apache.deltaspike.testcontrol.api.junit.CdiTestSuiteRunner$LogRunListener testFailureINFO: [failed] com.ford.it.deltaspike.data.sample.AppTest#testFindByLastNameReturningQueryResults message: An exception occurred while creating a query in EntityManager: Exception Description: Problem compiling [select p from PersonDE p where p.lastName like ?1 order by e.firstName ASC,e.age DESC]. [59, 70] The state field path 'e.firstName' cannot be resolved to a valid type.[76, 81] The state field path 'e.age' cannot be resolved to a valid type.[59, 60] The identification variable 'e' is not defined in the FROM clause.[76, 77] The identification variable 'e' is not defined in the FROM clause.Dec 17, 2015 5:43:04 PM org.apache.deltaspike.testcontrol.api.junit.CdiTestSuiteRunner$LogRunListener testFinishedINFO: [finished] com.ford.it.deltaspike.data.sample.AppTest#testFindByLastNameReturningQueryResults
-- View this message in context: http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/Documentation-Delta-Spike-Data-Query-Option-Example-Doesn-t-Work-tp4661947.html Sent from the Apache DeltaSpike Incubator Discussions mailing list archive at Nabble.com.
