一 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 }
时间: 2024-11-24 13:37:48