public class App {
public static void main(String[] args) {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("TestesPU");
EntityManager em = emf.createEntityManager();
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Person> criteriaQuery = cb.createQuery(Person.class);
Root<Person> root = criteriaQuery.from(Person.class);
root.fetch("PersonData"); //@OneToOne relationship
criteriaQuery.select(root);
System.out.println(em.createQuery(criteriaQuery).getResultList());
}
}
Exception in thread "main" [ObjectDB 2.5.6_05] javax.persistence.PersistenceException
Unexpected query expression end (non keyword identifier is expected) (error 751)
(position 9) at com.objectdb.jpa.JpaQuery.getResultList(JpaQuery.java:725)