There are 2 entities:
public class Firm { private String name; } public class Contractor { private Integer inn; @ManyToOne private Firm firm; } I am trying to get a list of companies whose contractor’s inn is equal to a certain number. There will be a list of Inn (so there may be many companies).
So far I have decided to do it for 1 Inn. Trying to do this:
criteria.createAlias("contractor", "contr"); criteria.add(Restrictions.eq("contr.inn", inn)); And I get an exeption org.hibernate.QueryException: could not resolve property: contractor of: Firm , which is correct in principle.
How to make a request that I need?
PS The request should be done to the Firm table.