我有结合多个表列的mysql View 。我只想从此 View 中选择数据以在html页面中显示Web。无需使用GORM创建/更新/删除。如何为该 View 定义域类?
我的看法是这样的。
view name: testview
col1 int,
col2 varchat(50),
col3 date
谢谢
最佳答案
假设col1是主键:
class View {
Integer col1
String col2
Date col3
static mapping = {
table name: "testview"
version false
id name: "col1", generator: "assigned"
// These are unnecessary unless you change the name of the fields
col1 column: "col1"
col2 column: "col2"
col3 column: "col3"
}
}
关于grails - grails为mysql View 创建域类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14150467/