简体   繁体   English

弹簧数据为嵌套列表对象查找

[英]spring data find by for nested list object

I am trying to write a findBy in the spring data where I want All employees where employees first department status is ACTIVE. 我正在尝试在春季数据中写一个findBy,我希望所有员工的第一部门状态为ACTIVE的员工。 Is it possible using spring data method name, without using custom query? 是否可以使用spring数据方法名称而不使用自定义查询?

something like List findByDepartmentFirstStatusIsActive(); 类似于List findByDepartmentFirstStatusIsActive();

I tried few, but none are working so I guess No!!! 我尝试了几次,但没有一个工作,所以我想不!!!

You can use under score character _ in order to separate nested property. 您可以使用下划线字符_来分隔嵌套属性。 For example: 例如:

findByDepartment_FirstStatus(Status status);

I assume that you have a property with name firstStatus of type Status in Department class, and obviously a field with name department of type Department in your Employee class (for example!). 我假设你有名称的属性firstStatus类型的StatusDepartment类,显然有名称的字段department类型的Department在你的Employee类(例如!)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM