Hibernate CriteriaBuilder

how we can use org.hibernate.criterion.Example by using hibernate CriteriaBuilder or hibernate Query?
I’m using hibernate 5.4.1.Final version. below is the code snappiest-
Criteria cr = getCurrentSession().createCritera(persistenClass()
class);
// createCritera method is depricated in 5.4.1.Final
Example ex = Example.create(exampleInstance);
crit.add(ex);

I want same line of code by using Query and CriteriaBuilder.

Could you please help to how we can achieve .