wood burning stoves 2.0*
The moose likes Groovy and the fly likes 1:m relationship Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Languages » Groovy
Bookmark "1:m relationship" Watch "1:m relationship" New topic
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
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

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.


GenRocket - Experts at Building Test Data
 
GeeCON Prague 2014
 
subject: 1:m relationship