Creating a Domain Class with schema in Grails

孤街醉人 提交于 2019-12-25 05:37:04

问题


I am attempting to create a domain object in Grails. Previously I been using MySQL with single database, so my domain object is always easily defined. User domain maps to user table in the current database.

This new project I am working requires me to use DB2, which when querying it, I must provide leading schema information. example: admin.user, Similar to database.table format. So now it is not so clear on how to create a Grails Domain object for this. Anyone have any reference or know how to solve this issue would be a great help.

Thank you.


回答1:


This should do the trick: http://grails.org/doc/2.0.x/ref/Database%20Mapping/table.html

static mapping = {
    table name: "book_catalog", schema: "dbo", catalog: "CRM"
}


来源:https://stackoverflow.com/questions/9182801/creating-a-domain-class-with-schema-in-grails

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