1.

How You Can Create Many-to-many Relationship In Gorm?

Answer»

Many-to-many RELATIONSHIPS in Grails can be specified by DEFINING a hasMany property on both sides and having a belongsTo on the owned side:

CLASS TAG {
static belongsTo = Post
static hasMany = [POSTS: Post]
}
class Post {
static hasMany = [tags: Tag]
}

Many-to-many relationships in Grails can be specified by defining a hasMany property on both sides and having a belongsTo on the owned side:

class Tag {
static belongsTo = Post
static hasMany = [posts: Post]
}
class Post {
static hasMany = [tags: Tag]
}



Discussion

No Comment Found