title: Criteria in hibernate 5.2
body: <p>I want to know why the following piece of code worked for me using eclipseLink and not using Hibernate 5.2</p>
  
  <pre><code>javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery();
  cq.select(cq.from(entityClass));
  return getEntityManager().createQuery(cq).getResultList();
  </code></pre>
  
  <p>this code is the implementation of a generic findAll() method that returns all rows of an entity. When I switch this implementation to one less generic, it's work.</p>
  
  <pre><code>Query query = getEntityManager().createQuery("from Answers");
  return query.getResultList();
  </code></pre>
  
  <p>So, why criteria doesn't work for me?</p>
  
  <p>Ps.: I want to use max of JPA as possible.</p>
  
  <p>EDIT: here is the log printed in the server side.</p>
  
  <pre><code>ago 13, 2017 5:16:24 PM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
  INFO: HHH000204: Processing PersistenceUnitInfo [
      name: testerHPU
      ...]
  ago 13, 2017 5:16:24 PM org.hibernate.Version logVersion
  INFO: HHH000412: Hibernate Core {5.2.10.Final}
  ago 13, 2017 5:16:24 PM org.hibernate.cfg.Environment &lt;clinit&gt;
  INFO: HHH000206: hibernate.properties not found
  ago 13, 2017 5:16:24 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager &lt;clinit&gt;
  INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
  ago 13, 2017 5:16:25 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
  WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
  ago 13, 2017 5:16:26 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
  INFO: HHH10001005: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/teste]
  ago 13, 2017 5:16:26 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
  INFO: HHH10001001: Connection properties: {user=root, password=****}
  ago 13, 2017 5:16:26 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
  INFO: HHH10001003: Autocommit mode: false
  ago 13, 2017 5:16:26 PM org.hibernate.engine.jdbc.connections.internal.PooledConnections &lt;init&gt;
  INFO: HHH000115: Hibernate connection pool size: 20 (min=1)
  ago 13, 2017 5:16:27 PM org.hibernate.dialect.Dialect &lt;init&gt;
  INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
  ago 13, 2017 5:16:29 PM org.hibernate.hql.internal.QueryTranslatorFactoryInitiator initiateService
  INFO: HHH000397: Using ASTQueryTranslatorFactory
  </code></pre>