jkuehn / gorm-mongodb

Grails GORM implementation for the MongoDB document oriented database
http://www.grails.org/plugin/mongodb-morphia
Apache License 2.0
21 stars 14 forks source link

Getting an error when trying a simple Domain Class #15

Open gkrasnow opened 11 years ago

gkrasnow commented 11 years ago

| Error 2012-12-11 14:41:49,349 [http-bio-8090-exec-10] ERROR errors.GrailsExceptionResolver - IllegalStateException occurred when processing request: [POST] /VektorServices/classB/save - parameters: b: dfgdfdsf create: Create Method on class [mongotest.ClassB] was used outside of a Grails application. If running in the context of a test using the mocking API or bootstrap Grails correctly.. Stacktrace follows: Message: Method on class [mongotest.ClassB] was used outside of a Grails application. If running in the context of a test using the mocking API or bootstrap Grails correctly. Line | Method ->> 134 | doCall in grails.plugins.mongodb.MongoPluginSupport$_addInstanceMethods_closure3


| 24 | save in mongotest.ClassBController | 195 | doFilter . . . . in grails.plugin.cache.web.filter.PageFragmentCachingFilter | 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter | 46 | doFilterInternal in org.grails.jaxrs.web.JaxrsFilter | 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 908 | run . . . . . . in '' ^ 680 | run in java.lang.Thread

package mongotest

import com.google.code.morphia.annotations.Entity
import grails.plugins.mongodb.ast.TransformationConfiguration
import com.google.code.morphia.annotations.Reference

@Entity
@TransformationConfiguration(injectId = true)
class ClassA {
    String foo
    Integer bar

    @Reference
    ClassB b

    Date dateCreated
    Date lastUpdated

    static constraints = {
    }
}

package mongotest

import com.google.code.morphia.annotations.Entity
import grails.plugins.mongodb.ast.TransformationConfiguration

@Entity
@TransformationConfiguration(injectId = true)
class ClassB {
    String b
    Date dateCreated
    Date lastUpdated

    static constraints = {
        b nullable: false
    }
}