NEO

蜀道难,难于上青天!

导航

Grails指南摘要-303-自定义对象映射

Posted on 2013-06-04 21:25  页面载入出错  阅读(166)  评论(0编辑  收藏  举报

domain对象如下

class Person {
    String frstName
    String lastName
    Integer age
}

属性和字段对应定义

class Person {
    String frstName
    String lastName
    Integer age
    static mapping = {
        id column:'person_id'
        frstName column:'person_frst_name'
        lastName column:'person_last_name'
        age column:'person_age'
        version false
    }
}

domain和表名对应定义

class Person {
    String frstName
    String lastName
    Integer age
    static mapping = {
          table 'people'
    }
}