grails: quering in a composite structure

Posted by Asaf David on Stack Overflow See other posts from Stack Overflow or by Asaf David
Published on 2010-04-24T12:52:31Z Indexed on 2010/04/24 12:53 UTC
Read the original article Hit count: 136

Filed under:
|
|
|

hey
i have the following domain model:

class Location {
    String name

    static hasMany = [locations:Location, persons:Person]
}

class Person {
    String name
}

so basically each location can hold a bunch of people + "sub-locations".
what is the best way to recursively query for all persons under a location (including it's sub locations, and their sub locations, etc')?

© Stack Overflow or respective owner

Related posts about grails

Related posts about groovy