1
我試圖使用數據庫視圖作爲域類,從Burt Beckwith幻燈片的步驟。Grails 2.3.4數據庫視圖爲域類
http://www.slideshare.net/gr8conf/gorm-burt-beckwith2011
我已經定義了配置類:
configClass = 'sfgroups.DdlFilterConfiguration'
包sfgroups
import org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsAnnotationConfiguration
class DdlFilterConfiguration extends GrailsAnnotationConfiguration {
private static final String[] IGNORED_NAMES={"v_fullname"}
private boolean isIgnored(String command){
command=command.toLowerCase()
for(String table : IGNORED_NAMES){
if(command.startsWith("create table " + table + " ") ||
command.startsWith("alter table " + table + " ") ||
command.startsWith("drop table " + table + " ") ||
command.startsWith("drop table if exists " + table + " ") ){
return true
}
}
return false
}
}
域類
package com.sfg
class FullName {
String firstname
String lastname
static mapping = {
table = 'v_fullname'
}
}
當運行申請提供它給出這個錯誤信息。
ERROR context.GrailsContextLoader - Error initializing the application: Error evaluating ORM mappings block for domain [com.sfg.FullName]: No such property: table for class: org.codehaus.groovy.grails.orm.hibernate.cfg.HibernateMappingBuilder
Message: Error evaluating ORM mappings block for domain [com.sfg.FullName]: No such property: table for class: org.codehaus.groovy.grails.orm.hibernate.cfg.HibernateMappingBuilder
我該如何解決這個啓動錯誤?
感謝
從你的映射[刪除'='跡象DOC](http://grails.org/doc/2.2.0/ref/Da tabase%20Mapping/table.html) – Alidad