Relative Content

Tag Archive for javamysqlhibernatejpahql

Hibernate Query: Unable to Fetch and Display Results using HQL

Session session = null; Query<InsurancePolicy> query = null; try { session = HibernateUtil.getSession(); query = session.createQuery(“select policyId, policyName FROM in.bean.InsurancePolicy where policyId=:id”); query.setParameter(“id”, 2L); List<InsurancePolicy> list = query.getResultList(); list.forEach(System.out::println); Can someone help me to understand this code. java mysql hibernate jpa hql