How to write such a request in Criteria?
SELECT place_id FROM place_has_menu WHERE menu_id=?; If our Menu class doesn't know anything about the Place class, then Place has a link to Menu OneToMany, which generates the table itself. How now to write this request, using metamodels?
Update1
@Entity @Table public class Place { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column private Long id; @JoinColumn(name = "name") private String name; @JoinColumn(name="file") private String file; @ManyToMany(mappedBy="places",cascade = CascadeType.ALL) private Set<PlaceType> placeTypes = new HashSet<PlaceType>(); @ManyToMany(mappedBy="placesToAdministrate", cascade=CascadeType.ALL) private Set<UserAccount> operators = new HashSet<UserAccount>(); @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinTable( name="place_has_menu", joinColumns = {@JoinColumn(name = "place_id")}, inverseJoinColumns = {@JoinColumn(name = "menu_id")} ) private Set<Menu> menus = new HashSet<Menu>(); In the classroom menu, I do not have any mention of Place. Is it possible then to configure this connection in the reverse order?
Update2 Answer: The problem in the request was not because the problems were with the hibernate docks, but because I had incorrectly configured entiti, which did not allow me to get data from the table I needed.