I am able to fetch records using
`Criteria crit = session.createCriteria(GenerateInvoiceBean.class);
crit.add(Restrictions.eq("dealerId", dealerId)).add(Restrictions.between("billDate", frDate, tDate));
List<GenerateInvoiceBean> gib = crit.list();
return gib;`
As createCriteria is deprecated in Hibernate 5.1.16, I am trying to use
`CriteriaBuilder builder = session.getCriteriaBuilder();
CriteriaQuery<GenerateInvoiceBean> query = builder.createQuery(GenerateInvoiceBean.class);
Root<GenerateInvoiceBean> root = query.from(GenerateInvoiceBean.class);
query.select(root).where(builder.equal(root.get("dealerId"), dealerId)).where(builder.between(root.get("billDate"), frDate, tDate))
.orderBy(builder.asc(root.get("billNo")));
List<GenerateInvoiceBean> gib = session.createQuery(query).getResultList();
return gib;`
which is not working. Any solution or suggestion would be great! Thanks
wheremultiple times? It will use the last one only! Pass multiple clauses in to the sole call towhere. Clearly "is not working" ought to have lead you to look at the LOG for the JPA provider and decide WHAT "is not working", and then tell people thatwherepart is working. Can you help me resolving it?Hibernate: select * from Invoice generatein0_ where generatein0_.bill_date between ? and ? order by generatein0_.bill_no ascHibernate is resolved to this query on log.wherecan take in MULTIPLE clauses. So pass in multiple clauses to a single call ofwhere!!