In Grails, I have two domain classes having many to many relationship
class VisitingUser
{
String name
static hasMany = [visitedCountries:VisitedCountry]
static belongsTo = VisitedCountry
}
class VisitedCountry
{
String countryName
static hasmany=[users:VisitingUser]
}
I want all those users who visited country "india" AND "usa" both.
Currently I am solving this problem by getting two list of visitingUsers, one for "india" and other for "usa" and then putting them in a Set.
I want a solution with using createCriteria or dynamic finder.