简体   繁体   中英

%Like% Query in spring JpaRepository for 2 fields

I have this object:

public class Menu {
       String menuId;
       String symbol;
}

I have create this method in te repository:

 List<Menu>  findByMenuIdOrSymbolContaining(String text);

but I have this error when I init the app.

Failed to create query for method public abstract java.util.List com.tdk.backend.persistence.repositories.MenuRepository.findByMenuIdOrSymbolContaining(java.lang.String)! null
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596)

The name findByMenuIdOrSymbolContaining suggests using two parameters, where at least one of them must fulfill some predicate. You would have to declare it this way:

findByMenuIdOrSymbolContaining(String menuId, String symbol);

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