title: spring mvc hiberate, use CriteriaQuery to run select * from table where
body: <p>what i need is to run a sql query something like :  </p>
  
  <pre><code>select * from table where alpahbetcolumn="A" and numbercolumn="10" and shelfcolumn="upper";
  </code></pre>
  
  <p>i want to know how to do this query in hibernate using <code>EntityManager</code></p>
  
  <p>currently this is my own try out, but not working....</p>
  
  <pre><code>@PersistenceContext
      EntityManager em;
  
  @Transactional
      public List&lt;Item&gt; listItems(String alpahbet, String number, String shelf) {
          CriteriaQuery&lt;Item&gt; c = em.getCriteriaBuilder().createQuery(Item.class);
          c.from(Item.class);
          c..where( em.equal( alpahbet, "alpahbetcolumn" ) &amp;&amp; em.equal( number, "numbercolumn" ) &amp;&amp; em.equal( shelf, "shelfcolumn" ));
          return em.createQuery(c).getResultList();
      }
  </code></pre>
  
  <p>i only have a very vague understanding on spring hibernate topic..still learning...
  can someone please point me out how to do this sql query properly, with code example. thanks</p>