grails-domain-id 无生成策略,由程序控制

一 domain class 中标示

class Menu implements Comparable<Menu>{
   String id;
   String name;  
}
static constraints = {
    //1
    id bindable : true
    name nullable:true
}
static mapping = {
    //2
    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 }
如果有使用请标明来源:http://www.cnblogs.com/duwenlei/
原文地址:https://www.cnblogs.com/duwenlei/p/4233114.html