java - Hibernate search in string array -
i new hibernate , looking a) solutions , b) comparison of solutions in terms of performance , query complexity.
example entity - (assume required hibernate annotations)
class ent{ string name; list<string> alias; }
i need solution can search string 'example' in name , alias array in single database query.
i able using hibernate raw sql ( select * ...). can suggest better solution using hql, criteria, etc.. reason
assuming alias
can empty:
select distinct e ent e left outer join e.alias e.name :term or a.name :term
or:
select e ent e e.name :term or e.id in (select e2.id ent e2 join e2.alias a.name :term)
i prefer second option because should faster (no distinct
) , because allows easier paging of results.
Comments
Post a Comment