问题
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