Changing GORM table name

人走茶凉 提交于 2020-02-27 23:06:49

问题


I'm fighting to get the following mapping working in Grails 1.3.1 and MySQL:

class Login {

    int id
    String email

    static mappings = {
        table 'my_table'
        id column: "Mgr_id"
        version false
    }
}

No matter what I do the queries that are being issued refer to "schema.login" table instead of "schema.my_table". This is very frustrating... Can anyone answer why this might not be working?


回答1:


Please forgive my blindness... The static is called mapping not mappings... eh. Shame on me...

Block should be

static mapping = {
    table 'my_table'
    id column: "Mgr_id"
    version false
}


来源:https://stackoverflow.com/questions/3066086/changing-gorm-table-name

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!