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
Post a Comment