首页 > 解决方案 > How to declare a GORM domain class without Grails?

问题描述

I'm making a project on Groovy + Spring using GORM, without implementing Grails. In order to do so, I'm following the guide that Grails provide (http://guides.grails.org/gorm-without-grails/guide/index.html). And even when I have the same Domains As them, when I run it and it bootstraps the data, it throws an exception saying that

Either class [domains.Manufacturer] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.

and this is my Manufacter.groovy file:

import grails.gorm.annotation.Entity
import groovy.transform.ToString
import org.grails.datastore.gorm.GormEntity

@ToString
@Entity
class Manufacturer implements GormEntity<Manufacturer> {

    String name

    static hasMany = [vehicles: Vehicle]

    static constraints = {
        name blank: false
    }
}

Any idea of why this error happens even though I have followed the exact same steps as them? Does it has something to do with dependencies version?

Thank you very much in advance

标签: springgroovygrails-orm

解决方案


推荐阅读