This calling is deprecated:
session.createCriteria(Bus.class).list();
In source files I can see this:
/** @deprecated */
@D         
        
I had the following method, changed the object names for security reasons:
public List listAllForIds(List ids) {
    Criteria criteria = getSessionFactory().getCurrentSession().createCriteria(MyObject.class)
            .createAlias("joinObject", "joinObject")
            .add(Restrictions.not(Restrictions.like("name", "string1", MatchMode.END)))
            .add(Restrictions.not(Restrictions.like("name", "string2", MatchMode.END)))
            .add(Restrictions.in("joinObject.id", ids));
    return criteria.list();
}
  Changing that to use:
javax.persistence.criteria.CriteriaBuilder
javax.persistence.criteria.CriteriaQuery
The query look like the following:
public List listAllForIds(List ids) {
    CriteriaBuilder builder = getSessionFactory().getCurrentSession().getCriteriaBuilder();
    CriteriaQuery criteria = builder.createQuery(MyObject.class);
    Root myObjectRoot = criteria.from(MyObject.class);
    Join joinObject = myObjectRoot.join("joinObject");
    Predicate likeRestriction = builder.and(
            builder.notLike( myObjectRoot.get("name"), "%string1"),
            builder.notLike( myObjectRoot.get("name"), "%string2")
    );
    criteria.select(myObjectRoot).where(joinObject.get("id").in(ids), likeRestriction);
    TypedQuery query = getSessionFactory().getCurrentSession().createQuery(criteria);
    return query.getResultList();
}
      Hope it helps someone else, please feel free to suggest any chanages to improve the code.