There are several places in the documentation where you use what appears to
be an incorrect JP QL query (see example below).  I tested these queries in
a sample project that we developed and they don’t work, nor do they seem to
make sense (take a look below) since query using the "count" option will
return a Long and the "order by" option a List.  To make it work as
appropriate for what was documented, we dropped the “order by p.age asc”
clause in all our sample project test cases.  I believe you will need to fix
those queries in the documentation as appropriate to be correct.  Incorrect
Query (only one of several places where this query was used):
-----------------------------------------------------------------------@NamedQuery(name
= Person.BY_MIN_AGE,    query = "select count(p) from Person p where p.age >
:minAge order by p.age asc")One corrected version: 
----------------------@Testpublic void
testCountAllOlderThanUsingNamedQuery() {       final int minAge = 32;      
final Long count =
personRepository.countAllOlderThanUsingNamedQuery(minAge);      
assertTrue(count > 0);              System.out.println("Using a Named @Query
annotation: named = PersonDE.BY_MIN_AGE");       System.out.println("   
There are " + count + " people in database older than " +
minAge);}@NamedQuery(name = PersonDE.COUNT_BY_MIN_AGE,       query = "select
count(p) from PersonDE p where p.age > ?1"),



--
View this message in context: 
http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/Documentation-Delta-Spike-Data-Incorrect-JP-QL-Query-Examples-tp4661946.html
Sent from the Apache DeltaSpike Incubator Discussions mailing list archive at 
Nabble.com.

Reply via email to