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

Trying to use generated scaffolding causes error #16

Open gkrasnow opened 11 years ago

gkrasnow commented 11 years ago

| Error 2012-12-11 17:58:19,705 [http-bio-8090-exec-10] ERROR mongodb.MongoDomainClass - Could not get instance from DB Message: invalid ObjectId [null] Line | Method ->> 128 | in org.bson.types.ObjectId


| 122 | in '' | 554 | _checkedId . . . in grails.plugins.mongodb.MongoPluginSupport | 240 | doCall in grails.plugins.mongodb.MongoPluginSupport$_addStaticMethods_closure13 | 34 | show . . . . . . in mongotest.DummyBController | 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

@Entity
@TransformationConfiguration(injectId = true, injectVersion = true)
class DummyB {
    transient mongo // spring bean, dependency injection

    String b
    Date dateCreated
    Date lastUpdated

    static constraints = {
        b nullable: false
    }

    def validate() {
        return true;
    }

    String toString() {
        'DummyB: ' + id + '::' + b
    }
}

There is a dummy validate() function to work around the previous issue I submitted where the validate() function is not found on the domain objects.