[英]How to find by id in set?
I have entity Account which have a set of Company我有实体帐户,其中有一组公司
class Account {
//other fields
Set<Company> companies;
}
And my Company entity looks like我的公司实体看起来像
class Company {
UUID id;
}
How can i correctly write a JPAmethod in AccountReposotiry for finding all account where one of company equals param?我如何正确地在 AccountReposotiry 中编写 JPAmethod 以查找其中一个公司等于参数的所有帐户?
Something like就像是
findAllByCompaniesContainingId(UUID companyId); findAllByCompaniesContainingId(UUID companyId);
You can use the below method in your AccountReposotiry
to get all Companies by companyId
您可以在
AccountReposotiry
中使用以下方法通过companyId
获取所有公司
findAllByCompaniesId(UUID companyId);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.