Reputation: 519
Hi I got a table as follow (User table)
+----------+------------+
| Code | reference |
+----------+------------+
| adfasd | hello |
+----------+------------+
| wertwtw | it works |
+----------+------------+
when I make a method ==> findByCodeContaining(String param) -it works as this link says
when I make a method ==> findByreferenceContaining(String param) -it works
But, when I make a method ==> findByCodeContainingOrfindByreferenceContaining(String param) it does not work. even though I follow this link
I would like to know why it does not work and where did I make it wrong. Thanks.
Upvotes: 0
Views: 52
Reputation: 519
I got it working as follow:
@Query("select u from User u where u.Code like ?1 or u.reference like ?2 ")
findByCodeContainingOrReferenceContaining(String param, String Param);
by following the above link.. thanks again.
Upvotes: 0
Reputation: 124461
Your method is wrong. Remove the second 'findBy` part
findByCodeContainingOrReferenceContaining(String param)
I would also expect it to be Reference
and not reference
. Depending on how you created your entities.
Upvotes: 1