一 domain class 中标示
class Menu implements Comparable<Menu>{
String id;
String name;
}
static constraints = {
//
id bindable : true
name nullable:true
}
static mapping = {
//
id column:'MENU_ID' , generator:'assigned'
name column:'MENU_NAME'
}
二 controller 中调用
// 1
@Transactional
def test(){
def m_lv1_i1 = new Menu(
name: 'home',
id: "m_lv1_i1"
).save flush: true
}