Hello everyone, I created two tables User and Account One user can have multiple accounts
This field is in the User entity.
@OneToMany(cascade = CascadeType.ALL, mappedBy = "user") private Set<Account>accounts; This field is essentially
@ManyToOne @JoinColumn(name = "user_id") private User user; The accounts in the table will be the id_user field. How to write a request to hibernate to find the user's accounts by name and phone number.
I write like this, and hibernate does not accept
Query query = entityManager.createQuery( "select account from account where user.name=:name AND user.number=:number");