If you use the canonical Metamodel , you will avoid such errors. In your code, you incorrectly used the keyword "dentist", which is probably the reason for your mistake, because "dentist" is not a field in the essence of the company.
However, looking at how you defined your class in another question, a way to determine if join with Metamodel:
SetJoin<Company,Product> products = companyRoot.join(Company_.products);
As you can see, Metamodel avoids the use of strings and thus avoids a lot of runtime errors. If you are not using Metamodel anyway, try the following:
SetJoin<Company,Product> products = companyRoot.join("products");
If you want to add predicate , i.e. something after where , you will write something like:
Predicate predicate = criteriaBuilder.equal(products.get(Product_.category), "dentist"); criteria.where(predicate);
If you want to add join for City object:
Join<Company, City> city = companyRoot.join(Company_.city); predicate = criteriaBuilder.and(predicate, criteriaBuilder.equal(city.get(City_.cityName), "Leeds"); criteria.where(predicate);
(suppose the cityName field is the correct field name for your city).
perissf Jan 26 2018-12-12T00: 00Z
source share