| Author |
1:m relationship
|
Maharaj thak
Greenhorn
Joined: Jul 29, 2010
Posts: 27
|
|
Hi All,
I have 2 domain classes.
class User {
String name
static hasMany=[queries:Query]
static constraints = {
}
}
class Query {
String question
static constraints = {
}
I have created 1 User and 2 queries e.g.
1. How high is Mt. Everest?
2. What's the capital of Spain?
Through the scaffolded view I add both the queries to the user.But when I am trying to delete one of the queries(by going to scaffolded view for the queries) I am getting an error.Is it the default behaviour in grails or am I doing something wrong?
Regards
Maharaj thak
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
A few things.
1. Please UseCodeTags when posting code.
2. You said you get an error. Please TellTheDetails
3. You're missing an important piece of the puzzle.
Query should belong to a User. You should add that to your Query domain. Everything else depends on the error you are getting.
|
 |
 |
|
|
subject: 1:m relationship
|
|
|