I have a table company: companyId number
, companyName varchar
, address nvarchar
.
I want to achieve a goal that user can query to fetch company either using a id or company name, image there is a search box, user only has to input a single value, then it will fetch company information.
I wrote an repository
@Query(value = "select c from CompanyBasicInfo c where c.companyID = ?1 or c.companyName = ?1 ")
List<CompanyBasicInfo> findByCompanyIDOrCompanyName(@PathVariable String input);
But when I query, I got an error: Parameter value [10083769] did not match expected type [java.lang.Long (n/a)]
How can I solve this problem? Most of the materials available are something like
findByFirstnameOrLastname
which uses two values. Thanks a lot!