Home > Enterprise >  What is the spring method query for IN expression?
What is the spring method query for IN expression?

Time:10-25

If I have a query like this,

SELECT * FROM COMPANIES WHERE COMPANY_ADDRESS IN ('Texas', 'California');

How can I convert this into a spring method name query instead of using @Query?

CodePudding user response:

The query method for your case would be:

List<Company> findAllByCompanyAddressIn(List<String> addresses);

If the COMPANY_ADDRESS column corresponds to companyAddress entity field.

  • Related