The gsp generated through scaffold are not correct when the id generator is 'assigned'
the gsp such as create.gsp does not contain the field related to id.
for example,
class Book {
id generator:'assigned', column:'isdn'
}
I think the create.gsp should contains some field such as 'isdn' to let users to fill in.
If no such field offered, hibernate will complain no id assigned manually.
The elegant solution I think for customized id is:
class Book {
String isdnOfBook
id generator:'assigned', column:'isdn', property:'isdnOfBook'
}
If the parameter named 'property' is present in the 'id dynamic method',
the id property will not auto created by Grails, and Grails will see the isdnOfBook as id.
Cheers,
Daniel.Sun
Description
The gsp generated through scaffold are not correct when the id generator is 'assigned'
the gsp such as create.gsp does not contain the field related to id.
for example,
class Book {
id generator:'assigned', column:'isdn'
}
I think the create.gsp should contains some field such as 'isdn' to let users to fill in.
If no such field offered, hibernate will complain no id assigned manually.
The elegant solution I think for customized id is:
class Book {
String isdnOfBook
id generator:'assigned', column:'isdn', property:'isdnOfBook'
}
If the parameter named 'property' is present in the 'id dynamic method',
the id property will not auto created by Grails, and Grails will see the isdnOfBook as id.
Cheers,
Daniel.Sun
should be placed in the mapping closure as the following:
class Book { String isdnOfBook static mapping = { table 'BOOK' id generator:'assigned', column:'isdn', property:'isdnOfBook' } }