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

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -