java.lang.ClassCastException: CriteriaQueryImpl cannot be cast to java.util.List

#1

Please follow the posting instructions and use a separate thread for each subject.

Your new question is not related to your original topic from 4 months ago, and therefore should not be discussed in this thread.

 

#2

The select method returns a CriteriaQuery instance (to be used for additional chained query building operations), not results.

To execute the query you have to create a TypedQuery (or Query) instance from your CriteriaQuery and then execute the query using getResultList:

    criteriaQuery.select(root);
    TypedQuery<Person> query = em.createQuery(criteriaQuery);
    allPersons = query.getResultList();

For more details see this manual page.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#3
Please delete me
#4

Please follow the posting instructions and use a separate thread for each subject.

Your new question is not related to your original topic from 4 months ago, and therefore should not be discussed in this thread.

 

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login