In one of my classes, say Location, I have something like this:
private List<Magician> magicians;
...
@OneToMany(fetch=FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumn(name="location_id")
public List<Magician> getMagicians() {
return magicians;
}
public void setMagicians(List<Magician> magicians) {
this.magicians = magicians;
}
where Magician has variables
private Integer id;
private Integer location_id;
private Boolean active;
Now I would like to modify the getter annotation so as to get only the magicians for which active is true.
How can I achieve this?
Thanks for your attention.