java - Spring Jpa Custom Query for Filtering on List-Property -
i have 1 entity called item. each item contains number of tags. want search within tags, , list of applications having same tag oder combined set of tags.
the query annotation "string tag;" not "list tags;". example want match tags (game, thriller) or (education, 12+).
i don't have clue, because use @entity. sql tables only, use table __item_tags (fid_item, fid_tag) , "select * fid_tag = 'game' or fid_tag = 'thriller'). here don't know how express within @query annotation..
@entity class item implements serializable { @id @generatedvalue private long id; list<string> tags; } public interface itemrepository extends jparepository<item, serializable>{ item findbyid(long id); @query("select item lower(a.tag) = lower(:tag)") list<item > findbytag(@param("tag") string tag); }
Comments
Post a Comment