我有一个控制器,如下所示。
delete object["key-1"]["inner_key_obj-2"];
AccountEntity如下
public String getAccountsFilter(
@PathVariable("cardHolderId") String cardHolderId,
@RequestParam(value = "accountType", required = false) String accountType,
@RequestParam(value = "name", required = false) String name)
我对public class AccountEntity implements Serializable {
private static final long serialVersionUID = 1L;
private String id;
private String accounttype;
private Date endDate;
private boolean active;
private PlanEntity planEntity;
private Set<TransactionEntryEntity> transactionEntry = new HashSet<TransactionEntryEntity>();
和id
进行了过滤,这很容易使用accountType
方法,并且会自动生成查询。
但是,如果我想使用findByIdAndAccountType()
和id
属性name
进行过滤,那么由于Plan (AccountEntity.PlanEntity.name)
来自子表,因此并不简单。我该如何处理这个标准?
答案 0 :(得分:2)
假设由@OneToOne或@OneToMany等注释了PlanEntity和TransactionEntryEntity
您可以在AccountEntity
存储库中的某个方法中执行以下操作@Query("select a from AccountEntity a where a.planEntity.name = :name")
public aMethod( @Param("name") String name)