Basicaly, its similar like looking if certain
word exists in sentence. There is entity Post:
What I am trying to implement is simple search mechanism. User eneters a word and if that word is consisted in the post's title, then the post is being returned.
So, I nedd JPQL query that will search for Post entity instances that have certain word/string (called
byTitle, passed as an argument) in their
title field, and two more arguments of
Date type, that represents date range -
startDate and
endDate.
I have something like this on my mind:
SELECT p FROM Post p WHERE :byTitle IN (set of strings created from parsing p.title field) AND p.date>=:startDate AND p.date<=:endDate
May be, that I wrong approached implementing this. If you have any experience with this kind of searching concept, I appreciate any help.
How to implement this kind of JPQL query? Or maybe JPA Criteria API should be used?