Could you please help me. I am new in Grails. I have read grails doc, but did not find answer for my questions.
class Customer:
package test
class Customer {
int points
static hasMany = [pr:Product]
List pr;
static constraints = {
}
}
class Product:
package test
class Product {
String question
int points
static belongsTo = [c:Customer]
static constraints = {
}
As we can see there is a one to many relation.
Then I want to add a lot of Products to one customer:
def cust = new Customer()
def pr = new Product();
cust.pr=new ArrayList();
cust.pr.add(pr);
Is this correct realization?
By default when you define a relationship with GORM it is a java.util.
Answer