title: Query with using CriteriaQuery and EntityManager(Hibernate)
body: <p>How create query with using CriteriaQuery and EntityManager for this SQL query:</p>
  
  <pre><code>SELECT * FROM user WHERE user.login = '?' and user.password = '?' 
  </code></pre>
  
  <p>I try so:</p>
  
  <pre><code>        final CriteriaBuilder criteriaBuilder = getEntityManager().getCriteriaBuilder();
          final CriteriaQuery&lt;User&gt; criteriaQuery = criteriaBuilder.createQuery(User.class);
          Root&lt;User&gt; root = criteriaQuery.from(User.class);
          criteriaQuery.select(root);
          criteriaQuery.where(criteriaBuilder.gt(root.get("login"), userLogin));
          return getEntityManager().createQuery(criteriaQuery).getResultList().get(0);
  </code></pre>