我使用Criteria API创建动态查询。我有实体:
class ProcessingActivityCategory{
(...)
@OneToMany
@JoinColumn(name = "id_kategoria_czynnosci", referencedColumnName = "id")
private Set<ActivityCategory> activityCategories;
}
和几个嵌套实体。我只想获取这些满足以下要求的ProcessingActivityCategory.activityCategories:
ProcessingActivityCategory.activityCategories.processActivity.personalData.company.id=x
and ProcessingActivityCategory.activityCategories.processActivity.personalData.administrator.id=y
下面是我的实体。如何使用@Filter和@FilterDef实现此目的?我应该在哪个地方/级别使用它?对于财产 ProcessingActivityCategory.activityCategories?但是,这个地方变得更深,创造了一个条件?
ActivityCategory:
@Entity
@Table(schema = "odo", name = "odo_czynnosc_kategoria")
public class ActivityCategory extends BaseEntity {
@OneToOne
@JoinColumn(name = "id_czynnosc", referencedColumnName = "id")
private ProcessingActivity processActivity;
(...)
ProcessingActivity:
Data
@Entity
@Table(schema = "odo", name = "odo_czynnosc_przetwarzania")
public class ProcessingActivity extends BaseEntity {
@OneToOne
@JoinColumn(name = "id_zbior", referencedColumnName = "id")
private PersonalData personalData;
(...)
个人数据:
Entity
@Table(schema = "odo", name = "odo_zbior")
@Data
public class PersonalData extends NameDescriptionEntity {
@OneToOne
@JoinColumn(name = "id_zbior_spolka", referencedColumnName = "id")
private Company company;
@OneToOne
@JoinColumn(name = "id_zbior_rodzaj", referencedColumnName = "id")
private DataKind dataKind;
@Column(name = "uwagi")
private String comments;
@OneToOne
@JoinColumn(name = "id_zbior_administrator", referencedColumnName = "id")
private Company administrator;
公司:
@Entity
@Data
@Table(schema = "odo", name = "d_odo_spolka")
public class Company{
private Long id
(...)