I have about the following:
class Object_1 {
static hasMany = [tags:Tag]
Set tags;
...
}
Now I have a set of tags and want to find all Object_1-instances with intersecting (!= matching) tags. I was thinking of something like
Object_1.findAllByTagsInList(tags);
But that does not work at all – I get a “nested exception is org.hibernate.exception.SQLGrammarException: could not execute query”. I have the feeling I am missing something important. Help highly appreciated.
I actually found an elegant way to solve the problem. I redesigned the relationship to be many-to-many which allows for simply iterating over the tags list finding all the relevant objects.
… of course now I have to take care of that relationship a couple of times – but I am happy to have this working with few locs.