Hibernate 休眠@OneToMany DTO@其中无效
我想根据条件竞争找出结果,但有效的是ExtendModule.getExtendFieldList上面的注释。我希望上面的注释使用ExtendModuleUndeletedData.getExtendFieldlist生效 我分析了调用ExtendModuleUndeletedData.getExtendFieldList时,hibernate代理调用ExtendModule.getExtendFieldList的原因,hibernate代理调用ExtendModule.getExtendFieldList 我不想要hibernate代理调用注释ExtendModule.getExtendFieldList。我确实想调用ExtendModuleUndeletedData.getExtendFieldList的注释 存储库Hibernate 休眠@OneToMany DTO@其中无效,hibernate,spring-data-jpa,Hibernate,Spring Data Jpa,我想根据条件竞争找出结果,但有效的是ExtendModule.getExtendFieldList上面的注释。我希望上面的注释使用ExtendModuleUndeletedData.getExtendFieldlist生效 我分析了调用ExtendModuleUndeletedData.getExtendFieldList时,hibernate代理调用ExtendModule.getExtendFieldList的原因,hibernate代理调用ExtendModule.getExtendFie
public interface ExtendModuleRepository extends BaseRepository<ExtendModule> {
List<ExtendModuleUndeletedData> findByDelIsFalse(String tableName, Sort sort);
}
公共接口ExtendModuleRepository扩展了BaseRepository{
List findByDelIsFalse(字符串表名、排序);
}
实体
@Entity
@Table(name = "t_extend_module")
@Getter
@Setter
public class ExtendModule extends CreateBaseEntity {
private String tableName;
private String label;
private int sort;
private List<ExtendField> extendFieldList;
private boolean del = false;
@OrderBy("sort asc")
@Where(clause = "del=true")// <---- valid annotation
@OneToMany(mappedBy = "extendModuleId", cascade = CascadeType.REMOVE)
public List<ExtendField> getExtendFieldList() {
return extendFieldList;
}
@Column(columnDefinition = "tinyint", length=1)
public boolean isDel() {
return del;
}
}
@实体
@表(name=“t_扩展_模块”)
@吸气剂
@塞特
公共类扩展模块扩展CreateBaseEntity{
私有字符串表名;
私有字符串标签;
私有整数排序;
私有列表扩展字段列表;
私有布尔del=false;
@订购人(“分拣asc”)
@Where(clause=“del=true”)//不清楚您想要做什么。您试图解决的实际问题是什么?我希望dto(ExtendModuleUndeletedData)中的注释@Where生效
public interface ExtendModuleUndeletedData {
@OrderBy("sort asc")
@Where(clause = "del=false")// <---- invalid annotation
List<ExtendField> getExtendFieldList();
boolean isDel();
String getId();
String getLabel();
int getSort();
}