Search code examples
grailsgrails-orm

How to break inheritance


I am using Grails. I'm trying to use values from one source as a method of searching another source.

def numbers=[];
//collection of Info maps
somemaps.each{
    numbers.add(it.id);
}
//THIS IS THE LINE THAT GENERATES THE ERROR
def info=Info.findAll("from Info as i where i.site in (:xsites)",['xsites':numbers]);

But I get this error

Subtype 'java.lang.Integer' of reloadable type myservices.Info is not reloadable:

How can I break the values of 'numbers' away from Info so they no longer have that type in the inheritance chain?


Solution

  • Well, my first question would be, is there a relationship between Info & Site. If so, why don't you try the actual identifier. As in,

    def info=Info.findAll("from Info as i where i.site.id in :xsites, ['xsites':numbers]");
    

    Or worse comes to worse, use createCriteria

    def info=Info.createCriteria().list{
        site{
            'in' ('id', numbers)
        }
     }