I am trying to use database view as domain class, following steps from Burt Beckwith slide.
http://www.slideshare.net/gr8conf/gorm-burt-beckwith2011
I have defined the config class:
configClass = 'sfgroups.DdlFilterConfiguration'
package 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
}
}
Domain class
package com.sfg
class FullName {
String firstname
String lastname
static mapping = {
table = 'v_fullname'
}
}
When I run the application its giving this error message.
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
how can I fix this startup error?
Thanks
use
static mapping = {
table 'v_fullname'
}
instead of
static mapping = {
table = 'v_fullname'
}