简体   繁体   中英

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. Is it possible using spring data method name, without using custom query?

something like 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!).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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