更改GORM表名称 [英] Changing GORM table name

查看:1128
本文介绍了更改GORM表名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力使以下映射在Grails 1.3.1和MySQL中起作用:

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
    }
}

无论我做什么查询都将引用"schema.login"表而不是"schema.my_table".这非常令人沮丧...有人可以回答为什么这可能不起作用吗?

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?

推荐答案

请原谅我的盲目性...静态称为mapping而不是mappings ... eh.真可惜...

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

块应该是

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

这篇关于更改GORM表名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆