what i need is to run a sql query something like :
select * from table where alpahbetcolumn="A" and numbercolumn="10" and shelfcolumn="upper";
i want to know how to do this query in hibernate using EntityManager
currently this is my own try out, but not working....
@PersistenceContext
EntityManager em;
@Transactional
public List<Item> listItems(String alpahbet, String number, String shelf) {
CriteriaQuery<Item> c = em.getCriteriaBuilder().createQuery(Item.class);
c.from(Item.class);
c..where( em.equal( alpahbet, "alpahbetcolumn" ) && em.equal( number, "numbercolumn" ) && em.equal( shelf, "shelfcolumn" ));
return em.createQuery(c).getResultList();
}
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