The API signature for select() enforces that generic type parameter T you specified on a CriteriaQuery q is same as the type you are selecting in q. That is the intended idea/advantage of strongly-typing an API, it reduces the risk of runtime error.
Now as per your posting, you had committed that the query will return a Corporation type, by the following statement: > CriteriaQuery<Corporation> q = cb.createQuery(Corporation.class); Few lines below, you stated that the query selects Corporation_.name (which, I am assuming, is a String) > q.select(corporation.get(Corporation_.name)) Hence, the compiler had rightfully complained. ----- Pinaki -- View this message in context: http://openjpa.208410.n2.nabble.com/JPA2-0-Criteria-API-question-select-tp5094119p5095806.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
