I have 3 tables, each mapped to an entity. The entities are something like this:
@Entity
@Table(name = "person")
public class Person implements Serializable {
private int id;
//other fields
}
@Entity
@Table(name = "phone")
public class Phone implements Serializable {
private int id;
private Long price;
@ManyToOne
@JoinColumn(name = "personId")
private Person person;
@ManyToOne
@JoinColumn(name = "manufacturerId")
private Manufacturer manufacturer;
//other fields
}
@Entity
@Table(name = "manufacturer")
public class Manufacturer implements Serializable {
private int id;
private String name;
//other fields
}
What I want to do is to create a method that will return a list of Persons that have phones from a specified manufacturer with the price in a specified range.
EDIT: My dao class implements EntityJpaDao . I would need a solution that would work with this implementation.