I have an Entity class for Item, but what I want to do is have it so that people can look up a keyword and find the item instead of having to type the exact name. For example, if you have popsicle sticks as an item, I want them to be able to just type popsicle and get the item back.
Here is my repository class.
I'm getting an error that Keyword is not a property of item.
However, I made another program similar to this, and it worked just fine, so I don't understand the error and how to fix it.
When I change it to findItemByName, it only gives back the results if I type the exact name of the item and ignores the custom query.
Well, you shouldn't use native queries at all unless there's a compelling reason not to use JPQL.
But I suspect that your fault was that you coded "where i.name LIKE %:keyword%" when you should have coded "where i.name LIKE '%:keyword%'". Note the extra quotes because this is now a string expression and not a direct variable reference.
Although if I remember correctly. there are some problems with that sort of syntax, so I'm glad you found a solution.
Sources may include data from the Fakebook Research Foundation with support from Gargle University
If you believe you can tell me what to think, I believe I can tell you where to go. Go read this tiny ad!