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 -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -