对于搜索功能,我必须实现一个相当重的查询以从指定范围(PLZAreaRange)返回所有基于位置的服务。如您所见,在我到达 PLZAreaRange 以将搜索条件与 plzText 进行比较之前,有很多继承结构。
public abstract class LocationbasedService {
@OneToOne
private Geography geography;
}
public abstract class Geography {
@OneToOne(mappedBy="geography")
private LocationbasedService locationbasedService;
}
public class Areageography extends Geography {
@ManyToOne
private Area from;
@ManyToOne
private Area to;
}
public abstract class Area {
}
public class PLZArea extends Area {
@OneToMany(mappedBy = "plzArea")
private List<PLZAreaRange> abschnitte = new ArrayList<PLZAreaRange>();
}
public class PLZAreaRange {
@ManyToOne(cascade=CascadeType.ALL)
private PLZArea plzArea;
private String plzText;
}
我如何加入该实体以选择所有具有 plzText 的服务(“test1”,“test2”)?
问候米