sql - HQL one to many query -


i have carmodel , carmodelcolor domain relationship carmodel hasmany carmodelcolor

carmodel{   string name    static hasmany = [carmodelcolors: carmodelcolor] }  carmodelcolor{   string color } 

now if pass 2 color red , black need models hai both color atleast. please note user can pass n number of color function , result need atleast n colors .

can done follow using in query

hql

select model carmodel model  join model.carmodelcolors modelcolors modelcolors.color in ? 

criteria

 carmodel.withcriteria {     carmodelcolors {        "in"("color", colorlist)     } } 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -